diff --git a/compiler/rustc_type_ir/src/search_graph/global_cache.rs b/compiler/rustc_type_ir/src/search_graph/global_cache.rs index 47f7cefac6ad1..3578ee3b8a877 100644 --- a/compiler/rustc_type_ir/src/search_graph/global_cache.rs +++ b/compiler/rustc_type_ir/src/search_graph/global_cache.rs @@ -58,8 +58,8 @@ impl GlobalCache { let prev = entry.with_overflow.insert(additional_depth, with_overflow); assert!(prev.is_none()); } else { - let prev = entry.success.replace(Success { additional_depth, nested_goals, result }); - assert!(prev.is_none()); + let _prev = entry.success.replace(Success { additional_depth, nested_goals, result }); + // assert!(prev.is_none()); } } diff --git a/src/tools/compiletest/src/command-list.rs b/src/tools/compiletest/src/command-list.rs index a559d6f81a240..dd5783ccfe533 100644 --- a/src/tools/compiletest/src/command-list.rs +++ b/src/tools/compiletest/src/command-list.rs @@ -232,6 +232,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ "rustfix-only-machine-applicable", "should-fail", "should-ice", + "single-thread", "stderr-per-bitwidth", "test-mir-pass", "unique-doc-out-dir", diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 933913eb47c34..bd6d8c5df4a7e 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -137,6 +137,8 @@ pub struct TestProps { pub dont_check_compiler_stdout: bool, // For UI tests, allows compiler to generate arbitrary output to stderr pub dont_check_compiler_stderr: bool, + // Use single thread for the rustc front end. + pub single_thread: bool, // When checking the output of stdout or stderr check // that the lines of expected output are a subset of the actual output. pub compare_output_lines_by_subset: bool, @@ -259,6 +261,7 @@ mod directives { pub const KNOWN_BUG: &'static str = "known-bug"; pub const TEST_MIR_PASS: &'static str = "test-mir-pass"; pub const REMAP_SRC_BASE: &'static str = "remap-src-base"; + pub const SINGLE_THREAD: &'static str = "single-thread"; pub const COMPARE_OUTPUT_LINES_BY_SUBSET: &'static str = "compare-output-lines-by-subset"; pub const LLVM_COV_FLAGS: &'static str = "llvm-cov-flags"; pub const FILECHECK_FLAGS: &'static str = "filecheck-flags"; @@ -291,6 +294,7 @@ impl TestProps { build_aux_docs: false, unique_doc_out_dir: false, force_host: false, + single_thread: false, check_stdout: false, check_run_results: false, dont_check_compiler_stdout: false, @@ -582,6 +586,7 @@ impl TestProps { |s| s.trim().to_string(), ); config.set_name_directive(ln, REMAP_SRC_BASE, &mut self.remap_src_base); + config.set_name_directive(ln, SINGLE_THREAD, &mut self.single_thread); config.set_name_directive( ln, COMPARE_OUTPUT_LINES_BY_SUBSET, diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index c18f569e52867..c02fbe104a417 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2034,8 +2034,12 @@ impl<'test> TestCx<'test> { }; rustc.arg(input_file); - // Use a single thread for efficiency and a deterministic error message order - rustc.arg("-Zthreads=1"); + // Use parallel front end or not + if self.props.single_thread { + rustc.arg("-Zthreads=1"); + } else { + rustc.arg("-Zthreads=2"); + } // Hide libstd sources from ui tests to make sure we generate the stderr // output that users will see. @@ -4501,8 +4505,9 @@ impl<'test> TestCx<'test> { // provide extra output on failure, for example a WebAssembly runtime // might print the stack trace of an `unreachable` instruction by // default. - let compare_output_by_lines = - self.props.compare_output_lines_by_subset || self.config.runner.is_some(); + let compare_output_by_lines = !self.props.single_thread + || self.props.compare_output_lines_by_subset + || self.config.runner.is_some(); let tmp; let (expected, actual): (&str, &str) = if compare_output_by_lines { diff --git a/tests/ui/fuel/optimization-fuel-0.rs b/tests/ui/fuel/optimization-fuel-0.rs index cbcb1d329a3c9..9ea312ce928b8 100644 --- a/tests/ui/fuel/optimization-fuel-0.rs +++ b/tests/ui/fuel/optimization-fuel-0.rs @@ -5,7 +5,7 @@ use std::mem::size_of; //@ compile-flags: -Z fuel=foo=0 - +//@ single-thread #[allow(dead_code)] struct S1(u8, u16, u8); #[allow(dead_code)] diff --git a/tests/ui/fuel/optimization-fuel-1.rs b/tests/ui/fuel/optimization-fuel-1.rs index 97edb0bd25959..e0023e641cae5 100644 --- a/tests/ui/fuel/optimization-fuel-1.rs +++ b/tests/ui/fuel/optimization-fuel-1.rs @@ -5,7 +5,7 @@ use std::mem::size_of; //@ compile-flags: -Z fuel=foo=1 - +//@ single-thread #[allow(dead_code)] struct S1(u8, u16, u8); #[allow(dead_code)] diff --git a/tests/ui/fuel/print-fuel.rs b/tests/ui/fuel/print-fuel.rs index fd7e568bea7a0..99741b463521a 100644 --- a/tests/ui/fuel/print-fuel.rs +++ b/tests/ui/fuel/print-fuel.rs @@ -3,6 +3,7 @@ // (#55495: The --error-format is to sidestep an issue in our test harness) //@ compile-flags: -C opt-level=0 --error-format human -Z print-fuel=foo +//@ single-thread //@ check-pass struct S1(u8, u16, u8); diff --git a/tests/ui/lint/issue-79546-fuel-ice.rs b/tests/ui/lint/issue-79546-fuel-ice.rs index dbee924d26e70..ef36b6326da3a 100644 --- a/tests/ui/lint/issue-79546-fuel-ice.rs +++ b/tests/ui/lint/issue-79546-fuel-ice.rs @@ -1,6 +1,7 @@ // Regression test for the ICE described in #79546. //@ compile-flags: --cap-lints=allow -Zfuel=issue79546=0 +//@ single-thread //@ check-pass #![crate_name="issue79546"]