Skip to content

Commit 1a3c6b4

Browse files
committed
Don't pass local_pm to compile_test_general
This argument is only used to inhibit `#![allow(unused)]` for `//@ run-pass` UI tests. No callers actually need to override this value, even when doing unusual things, so we can just look it up inside the method body instead.
1 parent 8172f47 commit 1a3c6b4

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

src/tools/compiletest/src/runtest.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -930,14 +930,13 @@ impl<'test> TestCx<'test> {
930930
}
931931

932932
fn compile_test(&self, will_execute: WillExecute, emit: Emit) -> ProcRes {
933-
self.compile_test_general(will_execute, emit, self.props.local_pass_mode(), Vec::new())
933+
self.compile_test_general(will_execute, emit, Vec::new())
934934
}
935935

936936
fn compile_test_general(
937937
&self,
938938
will_execute: WillExecute,
939939
emit: Emit,
940-
local_pm: Option<PassMode>,
941940
passes: Vec<String>,
942941
) -> ProcRes {
943942
let compiler_kind = self.compiler_kind_for_non_aux();
@@ -961,7 +960,7 @@ impl<'test> TestCx<'test> {
961960
// Note that we use the local pass mode here as we don't want
962961
// to set unused to allow if we've overridden the pass mode
963962
// via command line flags.
964-
&& local_pm != Some(PassMode::Run)
963+
&& self.props.local_pass_mode() != Some(PassMode::Run)
965964
{
966965
AllowUnused::Yes
967966
} else {

src/tools/compiletest/src/runtest/mir_opt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl TestCx<'_> {
1818

1919
let passes = std::mem::take(&mut test_info.passes);
2020

21-
let proc_res = self.compile_test_general(WillExecute::No, Emit::Mir, None, passes);
21+
let proc_res = self.compile_test_general(WillExecute::No, Emit::Mir, passes);
2222
if !proc_res.status.success() {
2323
self.fatal_proc_rec("compilation failed!", &proc_res);
2424
}

src/tools/compiletest/src/runtest/ui.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ impl TestCx<'_> {
1515
pub(super) fn run_ui_test(&self) {
1616
if let Some(FailMode::Build) = self.props.fail_mode {
1717
// Make sure a build-fail test cannot fail due to failing analysis (e.g. typeck).
18-
let pm = Some(PassMode::Check);
19-
let proc_res =
20-
self.compile_test_general(WillExecute::No, Emit::Metadata, pm, Vec::new());
21-
self.check_if_test_should_compile(self.props.fail_mode, pm, &proc_res);
18+
let proc_res = self.compile_test(WillExecute::No, Emit::Metadata);
19+
self.check_if_test_should_compile(
20+
self.props.fail_mode,
21+
Some(PassMode::Check),
22+
&proc_res,
23+
);
2224
}
2325

2426
let pm = self.pass_mode();

0 commit comments

Comments
 (0)