From 35935b8fd2506a584595360659f28ed29adad8d0 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Sun, 15 Oct 2023 01:20:52 -0400 Subject: [PATCH] Always put user-provided flags after CAREFUL_FLAGS so that defaults can be overridden --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index be830f1..399705b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -215,6 +215,7 @@ fn build_sysroot( std_features: STD_FEATURES.iter().copied().map(Into::into).collect(), } }) + // User-provided flags must come after CAREFUL_FLAGS so that they can be overridden. .rustflags(CAREFUL_FLAGS) .rustflags(rustflags); @@ -321,10 +322,11 @@ fn cargo_careful(args: env::Args) { }; // Invoke cargo for the real work. - let mut flags: Vec = rustflags.into_iter().map(Into::into).collect(); + let mut flags: Vec = CAREFUL_FLAGS.iter().map(Into::into).collect(); + // User-provided flags must come after CAREFUL_FLAGS so that they can be overridden. + flags.extend(rustflags.into_iter().map(Into::into)); flags.push("--sysroot".into()); flags.push(sysroot.into()); - flags.extend(CAREFUL_FLAGS.iter().map(Into::into)); if let Some(san) = sanitizer.as_deref() { flags.push(format!("-Zsanitizer={san}").into()); }