diff options
Diffstat (limited to 'tests/ui/parallel-rustc')
8 files changed, 669 insertions, 0 deletions
diff --git a/tests/ui/parallel-rustc/ty-variance-issue-124423.rs b/tests/ui/parallel-rustc/ty-variance-issue-124423.rs new file mode 100644 index 00000000000..8d7f29f7764 --- /dev/null +++ b/tests/ui/parallel-rustc/ty-variance-issue-124423.rs @@ -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() {} diff --git a/tests/ui/parallel-rustc/ty-variance-issue-124423.stderr b/tests/ui/parallel-rustc/ty-variance-issue-124423.stderr new file mode 100644 index 00000000000..7ba89f75bd1 --- /dev/null +++ b/tests/ui/parallel-rustc/ty-variance-issue-124423.stderr @@ -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`. diff --git a/tests/ui/parallel-rustc/ty-variance-issue-127971.rs b/tests/ui/parallel-rustc/ty-variance-issue-127971.rs new file mode 100644 index 00000000000..a17916843e7 --- /dev/null +++ b/tests/ui/parallel-rustc/ty-variance-issue-127971.rs @@ -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() {} diff --git a/tests/ui/parallel-rustc/ty-variance-issue-127971.stderr b/tests/ui/parallel-rustc/ty-variance-issue-127971.stderr new file mode 100644 index 00000000000..9929d3ee22c --- /dev/null +++ b/tests/ui/parallel-rustc/ty-variance-issue-127971.stderr @@ -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`. diff --git a/tests/ui/parallel-rustc/undefined-function-issue-120760.rs b/tests/ui/parallel-rustc/undefined-function-issue-120760.rs new file mode 100644 index 00000000000..2665c30945b --- /dev/null +++ b/tests/ui/parallel-rustc/undefined-function-issue-120760.rs @@ -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` +} diff --git a/tests/ui/parallel-rustc/undefined-function-issue-120760.stderr b/tests/ui/parallel-rustc/undefined-function-issue-120760.stderr new file mode 100644 index 00000000000..87af5372219 --- /dev/null +++ b/tests/ui/parallel-rustc/undefined-function-issue-120760.stderr @@ -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`. diff --git a/tests/ui/parallel-rustc/unexpected-type-issue-120601.rs b/tests/ui/parallel-rustc/unexpected-type-issue-120601.rs new file mode 100644 index 00000000000..2e215aa301a --- /dev/null +++ b/tests/ui/parallel-rustc/unexpected-type-issue-120601.rs @@ -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() {} diff --git a/tests/ui/parallel-rustc/unexpected-type-issue-120601.stderr b/tests/ui/parallel-rustc/unexpected-type-issue-120601.stderr new file mode 100644 index 00000000000..ed563bb0c4e --- /dev/null +++ b/tests/ui/parallel-rustc/unexpected-type-issue-120601.stderr @@ -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`. |
