Skip to content

Commit f8d1b30

Browse files
committed
test(rustdocflags): shouldn't be affected by rustflags from target.cfg
1 parent da20496 commit f8d1b30

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/testsuite/rustdocflags.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,35 @@ fn whitespace() {
122122
let contents = p.read_file("target/doc/foo/index.html");
123123
assert!(contents.contains(SPACED_VERSION));
124124
}
125+
126+
#[cargo_test]
127+
fn not_affected_by_target_rustflags() {
128+
let cfg = if cfg!(windows) { "windows" } else { "unix" };
129+
let p = project()
130+
.file("src/lib.rs", "")
131+
.file(
132+
".cargo/config",
133+
&format!(
134+
r#"
135+
[target.'cfg({cfg})']
136+
rustflags = ["-D", "missing-docs"]
137+
138+
[build]
139+
rustdocflags = ["--cfg", "foo"]
140+
"#,
141+
),
142+
)
143+
.build();
144+
145+
// `cargo build` should fail due to missing docs.
146+
p.cargo("build -v")
147+
.with_status(101)
148+
.with_stderr_contains("[RUNNING] `rustc [..] -D missing-docs[..]`")
149+
.run();
150+
151+
// This is wrong behaviour. `cargo doc` shouldn't fail.
152+
p.cargo("doc -v")
153+
.with_status(101)
154+
.with_stderr_contains("[RUNNING] `rustdoc [..] -D missing-docs[..]`")
155+
.run();
156+
}

0 commit comments

Comments
 (0)