--- a/config/makefiles/rust.mk
+++ b/config/makefiles/rust.mk
@@ -64,6 +64,7 @@ endif
 # These flags are passed via `cargo rustc` and only apply to the final rustc
 # invocation (i.e., only the top-level crate, not its dependencies).
 cargo_rustc_flags = $(CARGO_RUSTCFLAGS)
+ifneq (1,$(MOZ_NO_RUST_LTO))
 ifndef DEVELOPER_OPTIONS
 ifndef MOZ_DEBUG_RUST
 # Enable link-time optimization for release builds, but not when linking
@@ -77,6 +78,7 @@ RUSTFLAGS += -Cembed-bitcode=yes
 endif
 endif
 endif
+endif
 
 ifdef CARGO_INCREMENTAL
 export CARGO_INCREMENTAL
