diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-09-01 17:05:02 -0400 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-09-07 19:27:52 -0400 |
| commit | 072942d569b898ef65569a21bd1b73d15cc1caf6 (patch) | |
| tree | 8f3cb44c87de310cbe73b699234778fdf388da8e | |
| parent | 43a5ff4222e1f217ac14331afd59f82ec4204d12 (diff) | |
| download | rust-072942d569b898ef65569a21bd1b73d15cc1caf6.tar.gz rust-072942d569b898ef65569a21bd1b73d15cc1caf6.zip | |
run-pass tests shouldn't have unused contents
| -rw-r--r-- | src/tools/compiletest/src/header.rs | 5 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 819d399f34a..48dd68d0f61 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -628,6 +628,11 @@ impl TestProps { } self.pass_mode } + + // does not consider CLI override for pass mode + pub fn local_pass_mode(&self) -> Option<PassMode> { + self.pass_mode + } } fn iter_header(testfile: &Path, cfg: Option<&str>, it: &mut dyn FnMut(&str)) { diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 9a3d24facc2..aff554678a3 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1557,7 +1557,11 @@ impl<'test> TestCx<'test> { // want to actually assert warnings about all this code. Instead // let's just ignore unused code warnings by defaults and tests // can turn it back on if needed. - if !self.config.src_base.ends_with("rustdoc-ui") { + if !self.config.src_base.ends_with("rustdoc-ui") && + // Note that we don't call pass_mode() here as we don't want + // to set unused to allow if we've overriden the pass mode + // via command line flags. + self.props.local_pass_mode() != Some(PassMode::Run) { rustc.args(&["-A", "unused"]); } } |
