Skip to content

Commit d17ccec

Browse files
committed
Warn on misspelled env vars 'RUST_FLAGS' and 'RUSTDOC_FLAGS'
1 parent 469af67 commit d17ccec

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/cargo/ops/cargo_compile.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,27 @@ pub fn compile_ws<'a>(
245245
ref export_dir,
246246
} = *options;
247247

248+
match build_config.mode {
249+
CompileMode::Test
250+
| CompileMode::Build
251+
| CompileMode::Check { .. }
252+
| CompileMode::Bench
253+
| CompileMode::RunCustomBuild => {
254+
if std::env::var("RUST_FLAGS").is_ok() {
255+
config.shell().warn(
256+
"Cargo does not read `RUST_FLAGS` environment variable. Did you mean `RUSTFLAGS`?",
257+
)?;
258+
}
259+
}
260+
CompileMode::Doc { .. } | CompileMode::Doctest => {
261+
if std::env::var("RUSTDOC_FLAGS").is_ok() {
262+
config.shell().warn(
263+
"Cargo does not read `RUSTDOC_FLAGS` environment variable. Did you mean `RUSTDOCFLAGS`?"
264+
)?;
265+
}
266+
}
267+
}
268+
248269
let default_arch_kind = if build_config.requested_target.is_some() {
249270
Kind::Target
250271
} else {

0 commit comments

Comments
 (0)