Skip to content

Commit 7d71b87

Browse files
Correctly set --cap-lints when running regex tests
1 parent ad1d541 commit 7d71b87

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

build_system/src/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,11 @@ impl ConfigInfo {
149149
.extend_from_slice(&["--sysroot".to_string(), sysroot_path.display().to_string()]);
150150
};
151151

152+
// This environment variable is useful in case we want to change options of rustc commands.
152153
if let Some(cg_rustflags) = env.get("CG_RUSTFLAGS") {
153154
rustflags.extend_from_slice(&split_args(&cg_rustflags));
154155
}
156+
155157
if let Some(linker) = linker {
156158
rustflags.push(linker.to_string());
157159
}

build_system/src/test.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,8 @@ fn extended_regex_example_tests(env: &Env, args: &TestArg) -> Result<(), String>
750750
println!("[TEST] rust-lang/regex example shootout-regex-dna");
751751
let mut env = env.clone();
752752
// newer aho_corasick versions throw a deprecation warning
753-
env.insert("CG_RUSTFLAGS".to_string(), "--cap-lints warn".to_string());
753+
let rustflags = format!("{} --cap-lints warn", env.get("RUSTFLAGS").cloned().unwrap_or_default());
754+
env.insert("RUSTFLAGS".to_string(), rustflags);
754755
// Make sure `[codegen mono items] start` doesn't poison the diff
755756
run_cargo_command(
756757
&[&"build", &"--example", &"shootout-regex-dna"],
@@ -798,7 +799,8 @@ fn extended_regex_tests(env: &Env, args: &TestArg) -> Result<(), String> {
798799
println!("[TEST] rust-lang/regex tests");
799800
let mut env = env.clone();
800801
// newer aho_corasick versions throw a deprecation warning
801-
env.insert("CG_RUSTFLAGS".to_string(), "--cap-lints warn".to_string());
802+
let rustflags = format!("{} --cap-lints warn", env.get("RUSTFLAGS").cloned().unwrap_or_default());
803+
env.insert("RUSTFLAGS".to_string(), rustflags);
802804
run_cargo_command(
803805
&[
804806
&"test",

0 commit comments

Comments
 (0)