Skip to content

Commit 8c01bd1

Browse files
authored
[cargo-zerocopy] Pass RUSTDOCFLAGS (#2987)
Pass the same set of flags to `RUSTFLAGS` and `RUSTDOCFLAGS`. Some of our tests - specifically `src/doctests.rs` - use `cfg`s which are set by `cargo-zerocopy`, but these were previously not passed when evaluating doc tests. This follows up on #2960, which introduced this bug. gherrit-pr-id: G413a86267ff4384a9806de9a784407f1f5be96aa
1 parent d296c26 commit 8c01bd1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tools/cargo-zerocopy/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,10 @@ fn delegate_cargo() -> Result<(), Error> {
239239
env_rustflags,
240240
);
241241

242+
// Pass RUSTFLAGS to both Rust (via `RUSTFLAGS`) and Rustdoc
243+
// (via `RUSTDOCFLAGS`).
242244
let mut cmd = rustup(["run", version, "cargo"], Some(("RUSTFLAGS", &rustflags)));
245+
cmd.env("RUSTDOCFLAGS", &rustflags);
243246

244247
if env::var("CARGO_TARGET_DIR").is_ok() {
245248
eprintln!("[cargo-zerocopy] WARNING: `CARGO_TARGET_DIR` is set - this may cause `cargo-zerocopy` to behave unexpectedly");

0 commit comments

Comments
 (0)