Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always put user-provided flags after CAREFUL_FLAGS #23

Merged
merged 1 commit into from
Oct 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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