Skip to content

Commit

Permalink
Merge pull request #23 from saethlin/rustflags-precedence
Browse files Browse the repository at this point in the history
Always put user-provided flags after CAREFUL_FLAGS
  • Loading branch information
RalfJung authored Oct 15, 2023
2 parents a338cfc + 35935b8 commit 7fa90c6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -321,10 +322,11 @@ fn cargo_careful(args: env::Args) {
};

// Invoke cargo for the real work.
let mut flags: Vec<OsString> = rustflags.into_iter().map(Into::into).collect();
let mut flags: Vec<OsString> = 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());
}
Expand Down

0 comments on commit 7fa90c6

Please sign in to comment.