Skip to content

Commit 4ffb429

Browse files
run-pass tests shouldn't have unused contents
1 parent 9af1775 commit 4ffb429

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/tools/compiletest/src/header.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,11 @@ impl TestProps {
616616
}
617617
self.pass_mode
618618
}
619+
620+
// does not consider CLI override for pass mode
621+
pub fn local_pass_mode(&self) -> Option<PassMode> {
622+
self.pass_mode
623+
}
619624
}
620625

621626
fn iter_header(testfile: &Path, cfg: Option<&str>, it: &mut dyn FnMut(&str)) {

src/tools/compiletest/src/runtest.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1551,7 +1551,11 @@ impl<'test> TestCx<'test> {
15511551
// want to actually assert warnings about all this code. Instead
15521552
// let's just ignore unused code warnings by defaults and tests
15531553
// can turn it back on if needed.
1554-
if !self.config.src_base.ends_with("rustdoc-ui") {
1554+
if !self.config.src_base.ends_with("rustdoc-ui") &&
1555+
// Note that we don't call pass_mode() here as we don't want
1556+
// to set unused to allow if we've overriden the pass mode
1557+
// via command line flags.
1558+
self.props.local_pass_mode() != Some(PassMode::Run) {
15551559
rustc.args(&["-A", "unused"]);
15561560
}
15571561
}

0 commit comments

Comments
 (0)