Auto merge of #145384 - ywxt:parallel-tests, r=jieyouxu
Add more tests for the parallel rustc At the moment, the parallel frontend test cases are severely lacking. Althought some reported issues have been resolved, they haven't been added into the tests. This PR arranges the resolved ICE issues and adds tests for them. Whether it is worthwhile to add a separate test suite for the paralel frontend still requires futher discussion. But we are trying coveraging issues being resolved through capability of the existing UI test suite. Discussion: [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Proposal.20for.20a.20dedicated.20test.20suite.20for.20t.E2.80.A6.20compiler-team.23906) Related issues: - rust-lang/rust#120760 - rust-lang/rust#124423 fixed by rust-lang/rust#140358 - rust-lang/rust#127971 fxied by rust-lang/rust#140358 - rust-lang/rust#120601 fixed by rust-lang/rust#127311 cc `@jieyouxu`
This commit is contained in:
@@ -111,6 +111,7 @@ for more details.
|
||||
| `forbid-output` | A pattern which must not appear in stderr/`cfail` output | `ui`, `incremental` | Regex pattern |
|
||||
| `run-flags` | Flags passed to the test executable | `ui` | Arbitrary flags |
|
||||
| `known-bug` | No error annotation needed due to known bug | `ui`, `crashes`, `incremental` | Issue number `#123456` |
|
||||
| `compare-output-by-lines` | Compare the output by lines, rather than as a single string | All | N/A |
|
||||
|
||||
[^check_stdout]: presently <!-- date-check: Oct 2024 --> this has a weird quirk
|
||||
where the test binary's stdout and stderr gets concatenated and then
|
||||
|
||||
@@ -95,6 +95,7 @@ will check for output files:
|
||||
[Normalization](#normalization)).
|
||||
- `dont-check-compiler-stderr` — Ignores stderr from the compiler.
|
||||
- `dont-check-compiler-stdout` — Ignores stdout from the compiler.
|
||||
- `compare-output-by-lines` — Some tests have non-deterministic orders of output, so we need to compare by lines.
|
||||
|
||||
UI tests run with `-Zdeduplicate-diagnostics=no` flag which disables rustc's
|
||||
built-in diagnostic deduplication mechanism. This means you may see some
|
||||
|
||||
@@ -205,6 +205,8 @@ pub struct TestProps {
|
||||
pub dont_require_annotations: HashSet<ErrorKind>,
|
||||
/// Whether pretty printers should be disabled in gdb.
|
||||
pub disable_gdb_pretty_printers: bool,
|
||||
/// Compare the output by lines, rather than as a single string.
|
||||
pub compare_output_by_lines: bool,
|
||||
}
|
||||
|
||||
mod directives {
|
||||
@@ -254,6 +256,7 @@ mod directives {
|
||||
// This isn't a real directive, just one that is probably mistyped often
|
||||
pub const INCORRECT_COMPILER_FLAGS: &'static str = "compiler-flags";
|
||||
pub const DISABLE_GDB_PRETTY_PRINTERS: &'static str = "disable-gdb-pretty-printers";
|
||||
pub const COMPARE_OUTPUT_BY_LINES: &'static str = "compare-output-by-lines";
|
||||
}
|
||||
|
||||
impl TestProps {
|
||||
@@ -310,6 +313,7 @@ impl TestProps {
|
||||
add_core_stubs: false,
|
||||
dont_require_annotations: Default::default(),
|
||||
disable_gdb_pretty_printers: false,
|
||||
compare_output_by_lines: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -664,6 +668,11 @@ impl TestProps {
|
||||
DISABLE_GDB_PRETTY_PRINTERS,
|
||||
&mut self.disable_gdb_pretty_printers,
|
||||
);
|
||||
config.set_name_directive(
|
||||
ln,
|
||||
COMPARE_OUTPUT_BY_LINES,
|
||||
&mut self.compare_output_by_lines,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
|
||||
"check-run-results",
|
||||
"check-stdout",
|
||||
"check-test-line-numbers-match",
|
||||
"compare-output-by-lines",
|
||||
"compile-flags",
|
||||
"disable-gdb-pretty-printers",
|
||||
"doc-flags",
|
||||
|
||||
@@ -2754,7 +2754,11 @@ 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 = 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 tmp;
|
||||
let (expected, actual): (&str, &str) = if compare_output_by_lines {
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
// Test for #111528, the ice issue cause waiting on a query that panicked
|
||||
//
|
||||
//@ compile-flags: -Z threads=16
|
||||
//@ build-fail
|
||||
//@ compare-output-by-lines
|
||||
|
||||
#![crate_type="rlib"]
|
||||
#![crate_type = "rlib"]
|
||||
#![allow(warnings)]
|
||||
|
||||
#[export_name="fail"]
|
||||
pub fn a() {
|
||||
}
|
||||
#[export_name = "fail"]
|
||||
pub fn a() {}
|
||||
|
||||
#[export_name="fail"]
|
||||
#[export_name = "fail"]
|
||||
pub fn b() {
|
||||
//~^ ERROR symbol `fail` is already defined
|
||||
//~^ ERROR symbol `fail` is already defined
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error: symbol `fail` is already defined
|
||||
--> $DIR/cache-after-waiting-issue-111528.rs:12:1
|
||||
--> $DIR/cache-after-waiting-issue-111528.rs:14:1
|
||||
|
|
||||
LL | pub fn b() {
|
||||
| ^^^^^^^^^^
|
||||
|
||||
8
tests/ui/parallel-rustc/cycle_crash-issue-135870.rs
Normal file
8
tests/ui/parallel-rustc/cycle_crash-issue-135870.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
// Test for #135870, which causes a deadlock bug
|
||||
//
|
||||
//@ compile-flags: -Z threads=2
|
||||
//@ compare-output-by-lines
|
||||
|
||||
const FOO: usize = FOO; //~ ERROR cycle detected when simplifying constant for the type system `FOO`
|
||||
|
||||
fn main() {}
|
||||
@@ -1,11 +1,11 @@
|
||||
error[E0391]: cycle detected when simplifying constant for the type system `FOO`
|
||||
--> $DIR/cycle_crash.rs:3:1
|
||||
--> $DIR/cycle_crash-issue-135870.rs:6:1
|
||||
|
|
||||
LL | const FOO: usize = FOO;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...which requires const-evaluating + checking `FOO`...
|
||||
--> $DIR/cycle_crash.rs:3:20
|
||||
--> $DIR/cycle_crash-issue-135870.rs:6:20
|
||||
|
|
||||
LL | const FOO: usize = FOO;
|
||||
| ^^^
|
||||
@@ -1,5 +0,0 @@
|
||||
//@ compile-flags: -Z threads=2
|
||||
|
||||
const FOO: usize = FOO; //~ERROR cycle detected when simplifying constant for the type system `FOO`
|
||||
|
||||
fn main() {}
|
||||
@@ -1,6 +1,10 @@
|
||||
// Test for #118205, which causes a deadlock bug
|
||||
//
|
||||
//@ compile-flags:-C extra-filename=-1 -Z threads=16
|
||||
//@ no-prefer-dynamic
|
||||
//@ build-pass
|
||||
//@ compare-output-by-lines
|
||||
|
||||
#![crate_name = "crateresolve1"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
// Test for #118205, which causes a deadlock bug
|
||||
//
|
||||
//@ compile-flags: -Z threads=16
|
||||
//@ build-pass
|
||||
//@ compare-output-by-lines
|
||||
|
||||
pub static GLOBAL: isize = 3;
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
// Test for the basic function of parallel front end
|
||||
//
|
||||
//@ compile-flags: -Z threads=8
|
||||
//@ run-pass
|
||||
//@ compare-output-by-lines
|
||||
|
||||
fn main() {
|
||||
println!("Hello world!");
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
// Test for #111520, which causes an ice bug cause of reading stolen value
|
||||
//
|
||||
//@ compile-flags: -Z threads=16
|
||||
//@ run-pass
|
||||
//@ compare-output-by-lines
|
||||
|
||||
#[repr(transparent)]
|
||||
struct Sched {
|
||||
i: i32,
|
||||
}
|
||||
impl Sched {
|
||||
extern "C" fn get(self) -> i32 { self.i }
|
||||
extern "C" fn get(self) -> i32 {
|
||||
self.i
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let s = Sched { i: 4 };
|
||||
let f = || -> i32 {
|
||||
s.get()
|
||||
};
|
||||
let f = || -> i32 { s.get() };
|
||||
println!("f: {}", f());
|
||||
}
|
||||
|
||||
58
tests/ui/parallel-rustc/ty-variance-issue-124423.rs
Normal file
58
tests/ui/parallel-rustc/ty-variance-issue-124423.rs
Normal file
@@ -0,0 +1,58 @@
|
||||
// Test for #124423, which causes an ice bug: only `variances_of` returns `&[ty::Variance]`
|
||||
//
|
||||
//@ compile-flags: -Z threads=16
|
||||
//@ compare-output-by-lines
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
fn elided(_: &impl Copy + 'a) -> _ { x }
|
||||
//~^ ERROR ambiguous `+` in a type
|
||||
//~| ERROR use of undeclared lifetime name `'a`
|
||||
//~| ERROR the placeholder `_` is not allowed within types on item signatures for return types
|
||||
|
||||
fn explicit<'b>(_: &'a impl Copy + 'a) -> impl 'a { x }
|
||||
//~^ ERROR ambiguous `+` in a type
|
||||
//~| ERROR at least one trait must be specified
|
||||
//~| ERROR use of undeclared lifetime name `'a`
|
||||
//~| ERROR use of undeclared lifetime name `'a`
|
||||
//~| ERROR use of undeclared lifetime name `'a`
|
||||
|
||||
fn elided2( impl 'b) -> impl 'a + 'a { x }
|
||||
//~^ ERROR expected one of `:` or `|`, found `'b`
|
||||
//~| ERROR expected identifier, found keyword `impl`
|
||||
//~| ERROR at least one trait must be specified
|
||||
//~| ERROR use of undeclared lifetime name `'a`
|
||||
//~| ERROR use of undeclared lifetime name `'a`
|
||||
|
||||
fn explicit2<'a>(_: &'a impl Copy + 'a) -> impl Copy + 'a { x }
|
||||
//~^ ERROR ambiguous `+` in a type
|
||||
|
||||
fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x }
|
||||
//~^ ERROR ambiguous `+` in a type
|
||||
//~| ERROR at least one trait must be specified
|
||||
//~| ERROR use of undeclared lifetime name `'b`
|
||||
|
||||
fn elided3(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) }
|
||||
//~^ ERROR ambiguous `+` in a type
|
||||
//~| ERROR use of undeclared lifetime name `'a`
|
||||
//~| ERROR use of undeclared lifetime name `'a`
|
||||
//~| ERROR at least one trait is required for an object type
|
||||
|
||||
fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
|
||||
//~^ ERROR ambiguous `+` in a type
|
||||
//~| ERROR use of undeclared lifetime name `'a`
|
||||
//~| ERROR use of undeclared lifetime name `'a`
|
||||
//~| ERROR at least one trait is required for an object type
|
||||
//~| ERROR no function or associated item named `u32` found for struct `Box<_, _>` in the current scope
|
||||
|
||||
fn elided4(_: &impl Copy + 'a) -> new { x(x) }
|
||||
//~^ ERROR ambiguous `+` in a type
|
||||
//~| ERROR use of undeclared lifetime name `'a`
|
||||
//~| ERROR cannot find type `new` in this scope
|
||||
|
||||
trait LifetimeTrait<'a> {}
|
||||
|
||||
impl<'a> LifetimeTrait<'a> for &'a Box<dyn 'a> {}
|
||||
//~^ ERROR at least one trait is required for an object type
|
||||
|
||||
fn main() {}
|
||||
287
tests/ui/parallel-rustc/ty-variance-issue-124423.stderr
Normal file
287
tests/ui/parallel-rustc/ty-variance-issue-124423.stderr
Normal file
@@ -0,0 +1,287 @@
|
||||
error: ambiguous `+` in a type
|
||||
--> $DIR/ty-variance-issue-124423.rs:8:15
|
||||
|
|
||||
LL | fn elided(_: &impl Copy + 'a) -> _ { x }
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
help: try adding parentheses
|
||||
|
|
||||
LL | fn elided(_: &(impl Copy + 'a)) -> _ { x }
|
||||
| + +
|
||||
|
||||
error: ambiguous `+` in a type
|
||||
--> $DIR/ty-variance-issue-124423.rs:13:24
|
||||
|
|
||||
LL | fn explicit<'b>(_: &'a impl Copy + 'a) -> impl 'a { x }
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
help: try adding parentheses
|
||||
|
|
||||
LL | fn explicit<'b>(_: &'a (impl Copy + 'a)) -> impl 'a { x }
|
||||
| + +
|
||||
|
||||
error: expected identifier, found keyword `impl`
|
||||
--> $DIR/ty-variance-issue-124423.rs:20:13
|
||||
|
|
||||
LL | fn elided2( impl 'b) -> impl 'a + 'a { x }
|
||||
| ^^^^ expected identifier, found keyword
|
||||
|
||||
error: expected one of `:` or `|`, found `'b`
|
||||
--> $DIR/ty-variance-issue-124423.rs:20:18
|
||||
|
|
||||
LL | fn elided2( impl 'b) -> impl 'a + 'a { x }
|
||||
| ^^ expected one of `:` or `|`
|
||||
|
||||
error: ambiguous `+` in a type
|
||||
--> $DIR/ty-variance-issue-124423.rs:27:25
|
||||
|
|
||||
LL | fn explicit2<'a>(_: &'a impl Copy + 'a) -> impl Copy + 'a { x }
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
help: try adding parentheses
|
||||
|
|
||||
LL | fn explicit2<'a>(_: &'a (impl Copy + 'a)) -> impl Copy + 'a { x }
|
||||
| + +
|
||||
|
||||
error: ambiguous `+` in a type
|
||||
--> $DIR/ty-variance-issue-124423.rs:30:16
|
||||
|
|
||||
LL | fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x }
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
help: try adding parentheses
|
||||
|
|
||||
LL | fn foo<'a>(_: &(impl Copy + 'a)) -> impl 'b + 'a { x }
|
||||
| + +
|
||||
|
||||
error: ambiguous `+` in a type
|
||||
--> $DIR/ty-variance-issue-124423.rs:35:16
|
||||
|
|
||||
LL | fn elided3(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) }
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
help: try adding parentheses
|
||||
|
|
||||
LL | fn elided3(_: &(impl Copy + 'a)) -> Box<dyn 'a> { Box::new(x) }
|
||||
| + +
|
||||
|
||||
error: ambiguous `+` in a type
|
||||
--> $DIR/ty-variance-issue-124423.rs:41:17
|
||||
|
|
||||
LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
help: try adding parentheses
|
||||
|
|
||||
LL | fn x<'b>(_: &'a (impl Copy + 'a)) -> Box<dyn 'b> { Box::u32(x) }
|
||||
| + +
|
||||
|
||||
error: ambiguous `+` in a type
|
||||
--> $DIR/ty-variance-issue-124423.rs:48:16
|
||||
|
|
||||
LL | fn elided4(_: &impl Copy + 'a) -> new { x(x) }
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
help: try adding parentheses
|
||||
|
|
||||
LL | fn elided4(_: &(impl Copy + 'a)) -> new { x(x) }
|
||||
| + +
|
||||
|
||||
error: at least one trait must be specified
|
||||
--> $DIR/ty-variance-issue-124423.rs:13:43
|
||||
|
|
||||
LL | fn explicit<'b>(_: &'a impl Copy + 'a) -> impl 'a { x }
|
||||
| ^^^^^^^
|
||||
|
||||
error: at least one trait must be specified
|
||||
--> $DIR/ty-variance-issue-124423.rs:20:25
|
||||
|
|
||||
LL | fn elided2( impl 'b) -> impl 'a + 'a { x }
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: at least one trait must be specified
|
||||
--> $DIR/ty-variance-issue-124423.rs:30:35
|
||||
|
|
||||
LL | fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x }
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/ty-variance-issue-124423.rs:8:27
|
||||
|
|
||||
LL | fn elided(_: &impl Copy + 'a) -> _ { x }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | fn elided<'a>(_: &impl Copy + 'a) -> _ { x }
|
||||
| ++++
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/ty-variance-issue-124423.rs:13:21
|
||||
|
|
||||
LL | fn explicit<'b>(_: &'a impl Copy + 'a) -> impl 'a { x }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | fn explicit<'a, 'b>(_: &'a impl Copy + 'a) -> impl 'a { x }
|
||||
| +++
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/ty-variance-issue-124423.rs:13:36
|
||||
|
|
||||
LL | fn explicit<'b>(_: &'a impl Copy + 'a) -> impl 'a { x }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | fn explicit<'a, 'b>(_: &'a impl Copy + 'a) -> impl 'a { x }
|
||||
| +++
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/ty-variance-issue-124423.rs:13:48
|
||||
|
|
||||
LL | fn explicit<'b>(_: &'a impl Copy + 'a) -> impl 'a { x }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | fn explicit<'a, 'b>(_: &'a impl Copy + 'a) -> impl 'a { x }
|
||||
| +++
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/ty-variance-issue-124423.rs:20:30
|
||||
|
|
||||
LL | fn elided2( impl 'b) -> impl 'a + 'a { x }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | fn elided2<'a>( impl 'b) -> impl 'a + 'a { x }
|
||||
| ++++
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/ty-variance-issue-124423.rs:20:35
|
||||
|
|
||||
LL | fn elided2( impl 'b) -> impl 'a + 'a { x }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | fn elided2<'a>( impl 'b) -> impl 'a + 'a { x }
|
||||
| ++++
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'b`
|
||||
--> $DIR/ty-variance-issue-124423.rs:30:40
|
||||
|
|
||||
LL | fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'b` here
|
||||
|
|
||||
LL | fn foo<'b, 'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x }
|
||||
| +++
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/ty-variance-issue-124423.rs:35:28
|
||||
|
|
||||
LL | fn elided3(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | fn elided3<'a>(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) }
|
||||
| ++++
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/ty-variance-issue-124423.rs:35:43
|
||||
|
|
||||
LL | fn elided3(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | fn elided3<'a>(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) }
|
||||
| ++++
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/ty-variance-issue-124423.rs:41:14
|
||||
|
|
||||
LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | fn x<'a, 'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
|
||||
| +++
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/ty-variance-issue-124423.rs:41:29
|
||||
|
|
||||
LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | fn x<'a, 'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
|
||||
| +++
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/ty-variance-issue-124423.rs:48:28
|
||||
|
|
||||
LL | fn elided4(_: &impl Copy + 'a) -> new { x(x) }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | fn elided4<'a>(_: &impl Copy + 'a) -> new { x(x) }
|
||||
| ++++
|
||||
|
||||
error[E0412]: cannot find type `new` in this scope
|
||||
--> $DIR/ty-variance-issue-124423.rs:48:36
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | fn elided3(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) }
|
||||
| ^^^^^^
|
||||
|
||||
error[E0224]: at least one trait is required for an object type
|
||||
--> $DIR/ty-variance-issue-124423.rs:41:40
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | impl<'a> LifetimeTrait<'a> for &'a Box<dyn 'a> {}
|
||||
| ^^^^^^
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/ty-variance-issue-124423.rs:8:34
|
||||
|
|
||||
LL | fn elided(_: &impl Copy + 'a) -> _ { x }
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0599]: no function or associated item named `u32` found for struct `Box<_, _>` in the current scope
|
||||
--> $DIR/ty-variance-issue-124423.rs:41:55
|
||||
|
|
||||
LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
|
||||
| ^^^ function or associated item not found in `Box<_, _>`
|
||||
|
|
||||
note: if you're trying to build a new `Box<_, _>` consider using one of the following associated functions:
|
||||
Box::<T>::new
|
||||
Box::<T>::new_uninit
|
||||
Box::<T>::new_zeroed
|
||||
Box::<T>::try_new
|
||||
and 22 others
|
||||
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
||||
|
||||
error: aborting due to 30 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0121, E0224, E0261, E0412, E0599.
|
||||
For more information about an error, try `rustc --explain E0121`.
|
||||
25
tests/ui/parallel-rustc/ty-variance-issue-127971.rs
Normal file
25
tests/ui/parallel-rustc/ty-variance-issue-127971.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
// Test for #127971, which causes an ice bug: only `variances_of` returns `&[ty::Variance]`
|
||||
//
|
||||
//@ compile-flags: -Z threads=16
|
||||
//@ compare-output-by-lines
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
fn elided(_: &impl Copy + 'a) -> _ { x }
|
||||
//~^ ERROR ambiguous `+` in a type
|
||||
//~| ERROR use of undeclared lifetime name `'a`
|
||||
//~| ERROR the placeholder `_` is not allowed within types on item signatures for return types
|
||||
|
||||
fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x }
|
||||
//~^ ERROR ambiguous `+` in a type
|
||||
//~| ERROR at least one trait must be specified
|
||||
//~| ERROR use of undeclared lifetime name `'b`
|
||||
|
||||
fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
|
||||
//~^ ERROR ambiguous `+` in a type
|
||||
//~| ERROR use of undeclared lifetime name `'a`
|
||||
//~| ERROR use of undeclared lifetime name `'a`
|
||||
//~| ERROR at least one trait is required for an object type
|
||||
//~| ERROR no function or associated item named `u32` found for struct `Box<_, _>` in the current scope
|
||||
|
||||
fn main() {}
|
||||
113
tests/ui/parallel-rustc/ty-variance-issue-127971.stderr
Normal file
113
tests/ui/parallel-rustc/ty-variance-issue-127971.stderr
Normal file
@@ -0,0 +1,113 @@
|
||||
error: ambiguous `+` in a type
|
||||
--> $DIR/ty-variance-issue-127971.rs:8:15
|
||||
|
|
||||
LL | fn elided(_: &impl Copy + 'a) -> _ { x }
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
help: try adding parentheses
|
||||
|
|
||||
LL | fn elided(_: &(impl Copy + 'a)) -> _ { x }
|
||||
| + +
|
||||
|
||||
error: ambiguous `+` in a type
|
||||
--> $DIR/ty-variance-issue-127971.rs:13:16
|
||||
|
|
||||
LL | fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x }
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
help: try adding parentheses
|
||||
|
|
||||
LL | fn foo<'a>(_: &(impl Copy + 'a)) -> impl 'b + 'a { x }
|
||||
| + +
|
||||
|
||||
error: ambiguous `+` in a type
|
||||
--> $DIR/ty-variance-issue-127971.rs:18:17
|
||||
|
|
||||
LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
help: try adding parentheses
|
||||
|
|
||||
LL | fn x<'b>(_: &'a (impl Copy + 'a)) -> Box<dyn 'b> { Box::u32(x) }
|
||||
| + +
|
||||
|
||||
error: at least one trait must be specified
|
||||
--> $DIR/ty-variance-issue-127971.rs:13:35
|
||||
|
|
||||
LL | fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x }
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/ty-variance-issue-127971.rs:8:27
|
||||
|
|
||||
LL | fn elided(_: &impl Copy + 'a) -> _ { x }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | fn elided<'a>(_: &impl Copy + 'a) -> _ { x }
|
||||
| ++++
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'b`
|
||||
--> $DIR/ty-variance-issue-127971.rs:13:40
|
||||
|
|
||||
LL | fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'b` here
|
||||
|
|
||||
LL | fn foo<'b, 'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x }
|
||||
| +++
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/ty-variance-issue-127971.rs:18:14
|
||||
|
|
||||
LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | fn x<'a, 'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
|
||||
| +++
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/ty-variance-issue-127971.rs:18:29
|
||||
|
|
||||
LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | fn x<'a, '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-127971.rs:18:40
|
||||
|
|
||||
LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
|
||||
| ^^^^^^
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/ty-variance-issue-127971.rs:8:34
|
||||
|
|
||||
LL | fn elided(_: &impl Copy + 'a) -> _ { x }
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0599]: no function or associated item named `u32` found for struct `Box<_, _>` in the current scope
|
||||
--> $DIR/ty-variance-issue-127971.rs:18:55
|
||||
|
|
||||
LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) }
|
||||
| ^^^ function or associated item not found in `Box<_, _>`
|
||||
|
|
||||
note: if you're trying to build a new `Box<_, _>` consider using one of the following associated functions:
|
||||
Box::<T>::new
|
||||
Box::<T>::new_uninit
|
||||
Box::<T>::new_zeroed
|
||||
Box::<T>::try_new
|
||||
and 22 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`.
|
||||
71
tests/ui/parallel-rustc/undefined-function-issue-120760.rs
Normal file
71
tests/ui/parallel-rustc/undefined-function-issue-120760.rs
Normal file
@@ -0,0 +1,71 @@
|
||||
// Test for #120760, which causes an ice bug: no index for a field
|
||||
//
|
||||
//@ compile-flags: -Z threads=45
|
||||
//@ edition: 2021
|
||||
//@ compare-output-by-lines
|
||||
|
||||
type BoxFuture<T> = std::pin::Pin<Box<dyn std::future::Future<Output = T>>>;
|
||||
|
||||
fn main() {
|
||||
let _ = f();
|
||||
}
|
||||
|
||||
async fn f() {
|
||||
run("dependency").await; //~ ERROR cannot find function `run` in this scope
|
||||
}
|
||||
|
||||
struct InMemoryStorage;
|
||||
|
||||
pub struct User<'dep> {
|
||||
pub name: &'a str, //~ ERROR use of undeclared lifetime name `'a`
|
||||
}
|
||||
|
||||
impl<'a> StorageRequest<InMemoryStorage> for SaveUser<'a> {
|
||||
fn execute(&self) -> BoxFuture<Result<(), String>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
trait Storage {
|
||||
type Error;
|
||||
}
|
||||
|
||||
impl Storage for InMemoryStorage {
|
||||
type Error = String;
|
||||
}
|
||||
|
||||
trait StorageRequestReturnType {
|
||||
type Output;
|
||||
}
|
||||
|
||||
trait StorageRequest<S: Storage>: StorageRequestReturnType {
|
||||
fn execute(
|
||||
&self,
|
||||
) -> BoxFuture<Result<<SaveUser as StorageRequestReturnType>::Output, <S as Storage>::Error>>;
|
||||
}
|
||||
|
||||
pub struct SaveUser<'a> {
|
||||
pub name: &'a str,
|
||||
}
|
||||
|
||||
impl<'a> StorageRequestReturnType for SaveUser<'a> {
|
||||
type Output = ();
|
||||
}
|
||||
|
||||
impl<'dep> User<'dep> {
|
||||
async fn save<S>(self)
|
||||
where
|
||||
S: Storage,
|
||||
for<'a> SaveUser<'a>: StorageRequest<S>,
|
||||
{
|
||||
let _ = run("dependency").await; //~ ERROR cannot find function `run` in this scope
|
||||
}
|
||||
}
|
||||
|
||||
async fn execute<S>(dep: &str)
|
||||
where
|
||||
S: Storage,
|
||||
for<'a> SaveUser<'a>: StorageRequest<S>,
|
||||
{
|
||||
User { dep }.save().await; //~ ERROR struct `User<'_>` has no field named `dep`
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/undefined-function-issue-120760.rs:20:16
|
||||
|
|
||||
LL | pub name: &'a str,
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | pub struct User<'a, 'dep> {
|
||||
| +++
|
||||
|
||||
error[E0425]: cannot find function `run` in this scope
|
||||
--> $DIR/undefined-function-issue-120760.rs:14:5
|
||||
|
|
||||
LL | run("dependency").await;
|
||||
| ^^^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find function `run` in this scope
|
||||
--> $DIR/undefined-function-issue-120760.rs:61:17
|
||||
|
|
||||
LL | let _ = run("dependency").await;
|
||||
| ^^^ not found in this scope
|
||||
|
||||
error[E0560]: struct `User<'_>` has no field named `dep`
|
||||
--> $DIR/undefined-function-issue-120760.rs:70:12
|
||||
|
|
||||
LL | User { dep }.save().await;
|
||||
| ^^^ `User<'_>` does not have this field
|
||||
|
|
||||
= note: available fields are: `name`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0261, E0425, E0560.
|
||||
For more information about an error, try `rustc --explain E0261`.
|
||||
28
tests/ui/parallel-rustc/unexpected-type-issue-120601.rs
Normal file
28
tests/ui/parallel-rustc/unexpected-type-issue-120601.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
// Test for #120601, which causes an ice bug cause of unexpected type
|
||||
//
|
||||
//@ compile-flags: -Z threads=40
|
||||
//@ compare-output-by-lines
|
||||
|
||||
struct T;
|
||||
struct Tuple(i32);
|
||||
|
||||
async fn foo() -> Result<(), ()> {
|
||||
Unstable2(())
|
||||
}
|
||||
//~^^^ ERROR `async fn` is not permitted in Rust 2015
|
||||
//~^^^ ERROR cannot find function, tuple struct or tuple variant `Unstable2` in this scope
|
||||
|
||||
async fn tuple() -> Tuple {
|
||||
Tuple(1i32)
|
||||
}
|
||||
//~^^^ ERROR `async fn` is not permitted in Rust 2015
|
||||
|
||||
async fn match_() {
|
||||
match tuple() {
|
||||
Tuple(_) => {}
|
||||
}
|
||||
}
|
||||
//~^^^^^ ERROR `async fn` is not permitted in Rust 2015
|
||||
//~^^^^ ERROR mismatched types
|
||||
|
||||
fn main() {}
|
||||
52
tests/ui/parallel-rustc/unexpected-type-issue-120601.stderr
Normal file
52
tests/ui/parallel-rustc/unexpected-type-issue-120601.stderr
Normal file
@@ -0,0 +1,52 @@
|
||||
error[E0670]: `async fn` is not permitted in Rust 2015
|
||||
--> $DIR/unexpected-type-issue-120601.rs:9:1
|
||||
|
|
||||
LL | async fn foo() -> Result<(), ()> {
|
||||
| ^^^^^ 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[E0670]: `async fn` is not permitted in Rust 2015
|
||||
--> $DIR/unexpected-type-issue-120601.rs:15:1
|
||||
|
|
||||
LL | async fn tuple() -> Tuple {
|
||||
| ^^^^^ 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[E0670]: `async fn` is not permitted in Rust 2015
|
||||
--> $DIR/unexpected-type-issue-120601.rs:20: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
|
||||
--> $DIR/unexpected-type-issue-120601.rs:10:5
|
||||
|
|
||||
LL | Unstable2(())
|
||||
| ^^^^^^^^^ not found in this scope
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/unexpected-type-issue-120601.rs:22:9
|
||||
|
|
||||
LL | match tuple() {
|
||||
| ------- this expression has type `impl Future<Output = Tuple>`
|
||||
LL | Tuple(_) => {}
|
||||
| ^^^^^^^^ expected future, found `Tuple`
|
||||
|
|
||||
= note: expected opaque type `impl Future<Output = Tuple>`
|
||||
found struct `Tuple`
|
||||
help: consider `await`ing on the `Future`
|
||||
|
|
||||
LL | match tuple().await {
|
||||
| ++++++
|
||||
|
||||
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`.
|
||||
Reference in New Issue
Block a user