Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2718,18 +2718,19 @@ impl<'test> TestCx<'test> {
// Wrapper tools set by `runner` might 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_subset = self.config.runner.is_some();

// Also, some tests like `ui/parallel-rustc` have non-deterministic
// orders of output, so we need to compare by lines.
let compare_output_by_lines =
self.props.compare_output_by_lines || self.config.runner.is_some();
let compare_output_by_lines = self.props.compare_output_by_lines;

let tmp;
let (expected, actual): (&str, &str) = if compare_output_by_lines {
let (expected, actual): (&str, &str) = if compare_output_by_lines_subset {
let actual_lines: HashSet<_> = actual.lines().collect();
let expected_lines: Vec<_> = expected.lines().collect();
let mut used = expected_lines.clone();
used.retain(|line| actual_lines.contains(line));

// check if `expected` contains a subset of the lines of `actual`
if used.len() == expected_lines.len() && (expected.is_empty() == actual.is_empty()) {
return CompareOutcome::Same;
Expand All @@ -2738,9 +2739,20 @@ impl<'test> TestCx<'test> {
// if we have no lines to check, force a full overwite
("", actual)
} else {
// this prints/blesses the subset, not the actual
tmp = (expected_lines.join("\n"), used.join("\n"));
(&tmp.0, &tmp.1)
}
} else if compare_output_by_lines {
let mut actual_lines: Vec<&str> = actual.lines().collect();
let mut expected_lines: Vec<&str> = expected.lines().collect();
actual_lines.sort_unstable();
expected_lines.sort_unstable();
if actual_lines == expected_lines {
return CompareOutcome::Same;
} else {
(expected, actual)
}
} else {
(expected, actual)
};
Expand Down
12 changes: 11 additions & 1 deletion tests/ui/parallel-rustc/cycle_crash-issue-135870.stderr
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
error[E0391]: cycle detected when checking if `FOO` is a trivial const
--> $DIR/cycle_crash-issue-135870.rs:6:1
|
LL | const FOO: usize = FOO;
| ^^^^^^^^^^^^^^^^
|
note: ...which requires building MIR for `FOO`...
--> $DIR/cycle_crash-issue-135870.rs:6:1
|
LL | const FOO: usize = FOO;
| ^^^^^^^^^^^^^^^^
= note: ...which again requires checking if `FOO` is a trivial const, completing the cycle
note: cycle used when simplifying constant for the type system `FOO`
--> $DIR/cycle_crash-issue-135870.rs:6:1
|
LL | const FOO: usize = FOO;
| ^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0391`.
For more information about this error, try `rustc --explain E0391`.
13 changes: 7 additions & 6 deletions tests/ui/parallel-rustc/ty-variance-issue-124423.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,10 @@ LL | fn elided4(_: &impl Copy + 'a) -> new { x(x) }
| ^^^ not found in this scope

error[E0224]: at least one trait is required for an object type
--> $DIR/ty-variance-issue-124423.rs:35:39
--> $DIR/ty-variance-issue-124423.rs:55:40
|
LL | fn elided3(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) }
| ^^^^^^
LL | impl<'a> LifetimeTrait<'a> for &'a Box<dyn 'a> {}
| ^^^^^^

error[E0224]: at least one trait is required for an object type
--> $DIR/ty-variance-issue-124423.rs:41:40
Expand All @@ -256,10 +256,10 @@ LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
| ^^^^^^

error[E0224]: at least one trait is required for an object type
--> $DIR/ty-variance-issue-124423.rs:55:40
--> $DIR/ty-variance-issue-124423.rs:35:39
|
LL | impl<'a> LifetimeTrait<'a> for &'a Box<dyn 'a> {}
| ^^^^^^
LL | fn elided3(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) }
| ^^^^^^

error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/ty-variance-issue-124423.rs:8:34
Expand All @@ -278,6 +278,7 @@ note: if you're trying to build a new `Box<_, _>` consider using one of the foll
Box::<T>::new_uninit
Box::<T>::new_zeroed
Box::<T>::try_new
and 27 others
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL

error: aborting due to 30 previous errors
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/parallel-rustc/ty-variance-issue-127971.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ note: if you're trying to build a new `Box<_, _>` consider using one of the foll
Box::<T>::new_uninit
Box::<T>::new_zeroed
Box::<T>::try_new
and 27 others
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL

error: aborting due to 11 previous errors

Some errors have detailed explanations: E0121, E0224, E0261, E0599.
For more information about an error, try `rustc --explain E0121`.
For more information about an error, try `rustc --explain E0121`.
17 changes: 11 additions & 6 deletions tests/ui/parallel-rustc/unexpected-type-issue-120601.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
error[E0670]: `async fn` is not permitted in Rust 2015
--> $DIR/unexpected-type-issue-120601.rs:10:1
|
LL | async fn foo() -> Result<(), ()> {
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
Expand All @@ -7,6 +8,7 @@ LL | async fn foo() -> Result<(), ()> {
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0670]: `async fn` is not permitted in Rust 2015
--> $DIR/unexpected-type-issue-120601.rs:16:1
|
LL | async fn tuple() -> Tuple {
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
Expand All @@ -15,19 +17,16 @@ LL | async fn tuple() -> Tuple {
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0670]: `async fn` is not permitted in Rust 2015
--> $DIR/unexpected-type-issue-120601.rs:21:1
|
LL | async fn match_() {
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
= help: pass `--edition 2024` to `rustc`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0425]: cannot find function, tuple struct or tuple variant `Unstable2` in this scope
|
LL | Unstable2(())
| ^^^^^^^^^ not found in this scope

error[E0308]: mismatched types
--> $DIR/unexpected-type-issue-120601.rs:23:9
|
LL | match tuple() {
| ------- this expression has type `impl Future<Output = Tuple>`
Expand All @@ -41,7 +40,13 @@ help: consider `await`ing on the `Future`
LL | match tuple().await {
| ++++++

error[E0425]: cannot find function, tuple struct or tuple variant `Unstable2` in this scope
--> $DIR/unexpected-type-issue-120601.rs:11:5
|
LL | Unstable2(())
| ^^^^^^^^^ not found in this scope

error: aborting due to 5 previous errors

Some errors have detailed explanations: E0308, E0425, E0670.
For more information about an error, try `rustc --explain E0308`.
For more information about an error, try `rustc --explain E0308`.
Loading