summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await')
-rw-r--r--tests/ui/async-await/async-trait-fn.current.stderr42
-rw-r--r--tests/ui/async-await/async-trait-fn.next.stderr42
-rw-r--r--tests/ui/async-await/async-trait-fn.rs1
-rw-r--r--tests/ui/async-await/async-trait-fn.stderr6
-rw-r--r--tests/ui/async-await/edition-deny-async-fns-2015.current.stderr (renamed from tests/ui/async-await/edition-deny-async-fns-2015.stderr)20
-rw-r--r--tests/ui/async-await/edition-deny-async-fns-2015.next.stderr98
-rw-r--r--tests/ui/async-await/edition-deny-async-fns-2015.rs2
-rw-r--r--tests/ui/async-await/generator-desc.stderr14
-rw-r--r--tests/ui/async-await/in-trait/async-associated-types.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-associated-types2.rs8
-rw-r--r--tests/ui/async-await/in-trait/async-default-fn-overridden.current.stderr (renamed from tests/ui/async-await/in-trait/async-default-fn-overridden.stderr)2
-rw-r--r--tests/ui/async-await/in-trait/async-default-fn-overridden.next.stderr11
-rw-r--r--tests/ui/async-await/in-trait/async-default-fn-overridden.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.current.stderr (renamed from tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr)4
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.next.stderr17
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed.current.stderr (renamed from tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr)2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed.next.stderr11
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-extra.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-manual.current.stderr (renamed from tests/ui/async-await/in-trait/async-example-desugared-manual.stderr)2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-manual.next.stderr11
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-manual.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-generics-and-bounds.current.stderr (renamed from tests/ui/async-await/in-trait/async-generics-and-bounds.stderr)12
-rw-r--r--tests/ui/async-await/in-trait/async-generics-and-bounds.next.stderr37
-rw-r--r--tests/ui/async-await/in-trait/async-generics-and-bounds.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-generics.current.stderr (renamed from tests/ui/async-await/in-trait/async-generics.stderr)12
-rw-r--r--tests/ui/async-await/in-trait/async-generics.next.stderr37
-rw-r--r--tests/ui/async-await/in-trait/async-generics.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-recursive-generic.current.stderr (renamed from tests/ui/async-await/in-trait/async-recursive-generic.stderr)2
-rw-r--r--tests/ui/async-await/in-trait/async-recursive-generic.next.stderr12
-rw-r--r--tests/ui/async-await/in-trait/async-recursive-generic.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-recursive.current.stderr (renamed from tests/ui/async-await/in-trait/async-recursive.stderr)2
-rw-r--r--tests/ui/async-await/in-trait/async-recursive.next.stderr12
-rw-r--r--tests/ui/async-await/in-trait/async-recursive.rs2
-rw-r--r--tests/ui/async-await/in-trait/bad-signatures.current.stderr (renamed from tests/ui/async-await/in-trait/bad-signatures.stderr)6
-rw-r--r--tests/ui/async-await/in-trait/bad-signatures.next.stderr26
-rw-r--r--tests/ui/async-await/in-trait/bad-signatures.rs2
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.current.stderr (renamed from tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr)4
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.next.stderr34
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs2
-rw-r--r--tests/ui/async-await/in-trait/early-bound-1.rs2
-rw-r--r--tests/ui/async-await/in-trait/early-bound-2.rs2
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err2.current.stderr (renamed from tests/ui/async-await/in-trait/fn-not-async-err2.stderr)2
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err2.next.stderr12
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err2.rs2
-rw-r--r--tests/ui/async-await/in-trait/generics-mismatch.current.stderr16
-rw-r--r--tests/ui/async-await/in-trait/generics-mismatch.next.stderr16
-rw-r--r--tests/ui/async-await/in-trait/generics-mismatch.rs15
-rw-r--r--tests/ui/async-await/in-trait/generics-mismatch.stderr16
-rw-r--r--tests/ui/async-await/in-trait/implied-bounds.rs2
-rw-r--r--tests/ui/async-await/in-trait/issue-102138.rs2
-rw-r--r--tests/ui/async-await/in-trait/issue-102219.rs2
-rw-r--r--tests/ui/async-await/in-trait/issue-102310.rs2
-rw-r--r--tests/ui/async-await/in-trait/issue-104678.rs2
-rw-r--r--tests/ui/async-await/in-trait/lifetime-mismatch.current.stderr (renamed from tests/ui/async-await/in-trait/lifetime-mismatch.stderr)4
-rw-r--r--tests/ui/async-await/in-trait/lifetime-mismatch.next.stderr21
-rw-r--r--tests/ui/async-await/in-trait/lifetime-mismatch.rs2
-rw-r--r--tests/ui/async-await/in-trait/missing-send-bound.current.stderr (renamed from tests/ui/async-await/in-trait/missing-send-bound.stderr)8
-rw-r--r--tests/ui/async-await/in-trait/missing-send-bound.next.stderr29
-rw-r--r--tests/ui/async-await/in-trait/missing-send-bound.rs2
-rw-r--r--tests/ui/async-await/in-trait/object-safety.current.stderr (renamed from tests/ui/async-await/in-trait/object-safety.stderr)6
-rw-r--r--tests/ui/async-await/in-trait/object-safety.next.stderr27
-rw-r--r--tests/ui/async-await/in-trait/object-safety.rs2
-rw-r--r--tests/ui/async-await/in-trait/return-type-suggestion.current.stderr (renamed from tests/ui/async-await/in-trait/return-type-suggestion.stderr)4
-rw-r--r--tests/ui/async-await/in-trait/return-type-suggestion.next.stderr23
-rw-r--r--tests/ui/async-await/in-trait/return-type-suggestion.rs2
-rw-r--r--tests/ui/async-await/issue-108572.rs12
-rw-r--r--tests/ui/async-await/issue-108572.stderr12
-rw-r--r--tests/ui/async-await/large_moves.attribute.stderr22
-rw-r--r--tests/ui/async-await/large_moves.option.stderr22
-rw-r--r--tests/ui/async-await/large_moves.rs2
-rw-r--r--tests/ui/async-await/missed-capture-issue-107414.rs24
-rw-r--r--tests/ui/async-await/no-const-async.rs1
-rw-r--r--tests/ui/async-await/no-const-async.stderr33
-rw-r--r--tests/ui/async-await/pin-needed-to-poll-2.stderr3
-rw-r--r--tests/ui/async-await/task-context-arg.rs25
-rw-r--r--tests/ui/async-await/track-caller/async-block.rs4
-rw-r--r--tests/ui/async-await/track-caller/async-block.stderr14
-rw-r--r--tests/ui/async-await/track-caller/panic-track-caller.rs13
82 files changed, 788 insertions, 139 deletions
diff --git a/tests/ui/async-await/async-trait-fn.current.stderr b/tests/ui/async-await/async-trait-fn.current.stderr
new file mode 100644
index 000000000..7ccf2f230
--- /dev/null
+++ b/tests/ui/async-await/async-trait-fn.current.stderr
@@ -0,0 +1,42 @@
+error[E0706]: functions in traits cannot be declared `async`
+ --> $DIR/async-trait-fn.rs:6:5
+ |
+LL | async fn foo() {}
+ | -----^^^^^^^^^
+ | |
+ | `async` because of this
+ |
+ = note: `async` trait functions are not currently supported
+ = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
+
+error[E0706]: functions in traits cannot be declared `async`
+ --> $DIR/async-trait-fn.rs:7:5
+ |
+LL | async fn bar(&self) {}
+ | -----^^^^^^^^^^^^^^
+ | |
+ | `async` because of this
+ |
+ = note: `async` trait functions are not currently supported
+ = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
+
+error[E0706]: functions in traits cannot be declared `async`
+ --> $DIR/async-trait-fn.rs:8:5
+ |
+LL | async fn baz() {
+ | -----^^^^^^^^^
+ | |
+ | `async` because of this
+ |
+ = note: `async` trait functions are not currently supported
+ = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0706`.
diff --git a/tests/ui/async-await/async-trait-fn.next.stderr b/tests/ui/async-await/async-trait-fn.next.stderr
new file mode 100644
index 000000000..7ccf2f230
--- /dev/null
+++ b/tests/ui/async-await/async-trait-fn.next.stderr
@@ -0,0 +1,42 @@
+error[E0706]: functions in traits cannot be declared `async`
+ --> $DIR/async-trait-fn.rs:6:5
+ |
+LL | async fn foo() {}
+ | -----^^^^^^^^^
+ | |
+ | `async` because of this
+ |
+ = note: `async` trait functions are not currently supported
+ = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
+
+error[E0706]: functions in traits cannot be declared `async`
+ --> $DIR/async-trait-fn.rs:7:5
+ |
+LL | async fn bar(&self) {}
+ | -----^^^^^^^^^^^^^^
+ | |
+ | `async` because of this
+ |
+ = note: `async` trait functions are not currently supported
+ = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
+
+error[E0706]: functions in traits cannot be declared `async`
+ --> $DIR/async-trait-fn.rs:8:5
+ |
+LL | async fn baz() {
+ | -----^^^^^^^^^
+ | |
+ | `async` because of this
+ |
+ = note: `async` trait functions are not currently supported
+ = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0706`.
diff --git a/tests/ui/async-await/async-trait-fn.rs b/tests/ui/async-await/async-trait-fn.rs
index e2062e827..04123badb 100644
--- a/tests/ui/async-await/async-trait-fn.rs
+++ b/tests/ui/async-await/async-trait-fn.rs
@@ -1,4 +1,5 @@
// edition:2018
+
trait T {
async fn foo() {} //~ ERROR functions in traits cannot be declared `async`
async fn bar(&self) {} //~ ERROR functions in traits cannot be declared `async`
diff --git a/tests/ui/async-await/async-trait-fn.stderr b/tests/ui/async-await/async-trait-fn.stderr
index afbe25cf7..68ebe3507 100644
--- a/tests/ui/async-await/async-trait-fn.stderr
+++ b/tests/ui/async-await/async-trait-fn.stderr
@@ -1,5 +1,5 @@
error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:3:5
+ --> $DIR/async-trait-fn.rs:4:5
|
LL | async fn foo() {}
| -----^^^^^^^^^
@@ -12,7 +12,7 @@ LL | async fn foo() {}
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:4:5
+ --> $DIR/async-trait-fn.rs:5:5
|
LL | async fn bar(&self) {}
| -----^^^^^^^^^^^^^^
@@ -25,7 +25,7 @@ LL | async fn bar(&self) {}
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:5:5
+ --> $DIR/async-trait-fn.rs:6:5
|
LL | async fn baz() {
| -----^^^^^^^^^
diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.stderr b/tests/ui/async-await/edition-deny-async-fns-2015.current.stderr
index ba918eb28..c47b99e65 100644
--- a/tests/ui/async-await/edition-deny-async-fns-2015.stderr
+++ b/tests/ui/async-await/edition-deny-async-fns-2015.current.stderr
@@ -1,5 +1,5 @@
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:3:1
+ --> $DIR/edition-deny-async-fns-2015.rs:5:1
|
LL | async fn foo() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -8,7 +8,7 @@ LL | async fn foo() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:5:12
+ --> $DIR/edition-deny-async-fns-2015.rs:7:12
|
LL | fn baz() { async fn foo() {} }
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -17,7 +17,7 @@ LL | fn baz() { async fn foo() {} }
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:7:1
+ --> $DIR/edition-deny-async-fns-2015.rs:9:1
|
LL | async fn async_baz() {
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -26,7 +26,7 @@ LL | async fn async_baz() {
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:8:5
+ --> $DIR/edition-deny-async-fns-2015.rs:10:5
|
LL | async fn bar() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -35,7 +35,7 @@ LL | async fn bar() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:14:5
+ --> $DIR/edition-deny-async-fns-2015.rs:16:5
|
LL | async fn foo() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -44,7 +44,7 @@ LL | async fn foo() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:18:5
+ --> $DIR/edition-deny-async-fns-2015.rs:20:5
|
LL | async fn foo() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -53,7 +53,7 @@ LL | async fn foo() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:36:9
+ --> $DIR/edition-deny-async-fns-2015.rs:38:9
|
LL | async fn bar() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -62,7 +62,7 @@ LL | async fn bar() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:26:9
+ --> $DIR/edition-deny-async-fns-2015.rs:28:9
|
LL | async fn foo() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -71,7 +71,7 @@ LL | async fn foo() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:31:13
+ --> $DIR/edition-deny-async-fns-2015.rs:33:13
|
LL | async fn bar() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -80,7 +80,7 @@ LL | async fn bar() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/edition-deny-async-fns-2015.rs:18:5
+ --> $DIR/edition-deny-async-fns-2015.rs:20:5
|
LL | async fn foo() {}
| -----^^^^^^^^^
diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.next.stderr b/tests/ui/async-await/edition-deny-async-fns-2015.next.stderr
new file mode 100644
index 000000000..c47b99e65
--- /dev/null
+++ b/tests/ui/async-await/edition-deny-async-fns-2015.next.stderr
@@ -0,0 +1,98 @@
+error[E0670]: `async fn` is not permitted in Rust 2015
+ --> $DIR/edition-deny-async-fns-2015.rs:5:1
+ |
+LL | async fn foo() {}
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` 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/edition-deny-async-fns-2015.rs:7:12
+ |
+LL | fn baz() { async fn foo() {} }
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` 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/edition-deny-async-fns-2015.rs:9:1
+ |
+LL | async fn async_baz() {
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` 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/edition-deny-async-fns-2015.rs:10:5
+ |
+LL | async fn bar() {}
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` 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/edition-deny-async-fns-2015.rs:16:5
+ |
+LL | async fn foo() {}
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` 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/edition-deny-async-fns-2015.rs:20:5
+ |
+LL | async fn foo() {}
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` 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/edition-deny-async-fns-2015.rs:38:9
+ |
+LL | async fn bar() {}
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` 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/edition-deny-async-fns-2015.rs:28:9
+ |
+LL | async fn foo() {}
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` 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/edition-deny-async-fns-2015.rs:33:13
+ |
+LL | async fn bar() {}
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` to `rustc`
+ = note: for more on editions, read https://doc.rust-lang.org/edition-guide
+
+error[E0706]: functions in traits cannot be declared `async`
+ --> $DIR/edition-deny-async-fns-2015.rs:20:5
+ |
+LL | async fn foo() {}
+ | -----^^^^^^^^^
+ | |
+ | `async` because of this
+ |
+ = note: `async` trait functions are not currently supported
+ = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
+
+error: aborting due to 10 previous errors
+
+Some errors have detailed explanations: E0670, E0706.
+For more information about an error, try `rustc --explain E0670`.
diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.rs b/tests/ui/async-await/edition-deny-async-fns-2015.rs
index 6bd6d879a..d4c30dc9d 100644
--- a/tests/ui/async-await/edition-deny-async-fns-2015.rs
+++ b/tests/ui/async-await/edition-deny-async-fns-2015.rs
@@ -1,4 +1,6 @@
// edition:2015
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
diff --git a/tests/ui/async-await/generator-desc.stderr b/tests/ui/async-await/generator-desc.stderr
index 51ac9d86b..042766f19 100644
--- a/tests/ui/async-await/generator-desc.stderr
+++ b/tests/ui/async-await/generator-desc.stderr
@@ -2,16 +2,18 @@ error[E0308]: mismatched types
--> $DIR/generator-desc.rs:10:19
|
LL | fun(async {}, async {});
- | -------- ^^^^^^^^
- | | |
- | | expected `async` block, found a different `async` block
- | | arguments to this function are incorrect
- | the expected `async` block
+ | --- -------- ^^^^^^^^ expected `async` block, found a different `async` block
+ | | |
+ | | the expected `async` block
+ | arguments to this function are incorrect
|
= note: expected `async` block `[async block@$DIR/generator-desc.rs:10:9: 10:17]`
found `async` block `[async block@$DIR/generator-desc.rs:10:19: 10:27]`
note: function defined here
- --> $SRC_DIR/core/src/future/mod.rs:LL:COL
+ --> $DIR/generator-desc.rs:8:4
+ |
+LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
+ | ^^^ -----
error[E0308]: mismatched types
--> $DIR/generator-desc.rs:12:16
diff --git a/tests/ui/async-await/in-trait/async-associated-types.rs b/tests/ui/async-await/in-trait/async-associated-types.rs
index 974f5aaff..89ca4039b 100644
--- a/tests/ui/async-await/in-trait/async-associated-types.rs
+++ b/tests/ui/async-await/in-trait/async-associated-types.rs
@@ -1,5 +1,7 @@
// check-pass
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(impl_trait_projections)]
diff --git a/tests/ui/async-await/in-trait/async-associated-types2.rs b/tests/ui/async-await/in-trait/async-associated-types2.rs
index e546a0579..b889f616a 100644
--- a/tests/ui/async-await/in-trait/async-associated-types2.rs
+++ b/tests/ui/async-await/in-trait/async-associated-types2.rs
@@ -1,8 +1,10 @@
// check-pass
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
-#![feature(type_alias_impl_trait)]
+#![feature(impl_trait_in_assoc_type)]
#![allow(incomplete_features)]
use std::future::Future;
@@ -21,9 +23,7 @@ impl MyTrait for i32 {
Self: 'a;
fn foo<'a>(&'a self) -> Self::Fut<'a> {
- async {
- *self
- }
+ async { *self }
}
}
diff --git a/tests/ui/async-await/in-trait/async-default-fn-overridden.stderr b/tests/ui/async-await/in-trait/async-default-fn-overridden.current.stderr
index 61a826258..2142ee232 100644
--- a/tests/ui/async-await/in-trait/async-default-fn-overridden.stderr
+++ b/tests/ui/async-await/in-trait/async-default-fn-overridden.current.stderr
@@ -1,5 +1,5 @@
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/async-default-fn-overridden.rs:4:12
+ --> $DIR/async-default-fn-overridden.rs:6:12
|
LL | #![feature(async_fn_in_trait)]
| ^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/async-await/in-trait/async-default-fn-overridden.next.stderr b/tests/ui/async-await/in-trait/async-default-fn-overridden.next.stderr
new file mode 100644
index 000000000..2142ee232
--- /dev/null
+++ b/tests/ui/async-await/in-trait/async-default-fn-overridden.next.stderr
@@ -0,0 +1,11 @@
+warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/async-default-fn-overridden.rs:6:12
+ |
+LL | #![feature(async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/async-await/in-trait/async-default-fn-overridden.rs b/tests/ui/async-await/in-trait/async-default-fn-overridden.rs
index 0fd1a2703..dd1af93d7 100644
--- a/tests/ui/async-await/in-trait/async-default-fn-overridden.rs
+++ b/tests/ui/async-await/in-trait/async-default-fn-overridden.rs
@@ -1,5 +1,7 @@
// run-pass
// edition:2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
//~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.current.stderr
index 168ef8e9e..b5ace9ada 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.current.stderr
@@ -1,11 +1,11 @@
error[E0053]: method `foo` has an incompatible type for trait
- --> $DIR/async-example-desugared-boxed-in-trait.rs:15:28
+ --> $DIR/async-example-desugared-boxed-in-trait.rs:17:28
|
LL | async fn foo(&self) -> i32 {
| ^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
|
note: type in trait
- --> $DIR/async-example-desugared-boxed-in-trait.rs:11:22
+ --> $DIR/async-example-desugared-boxed-in-trait.rs:13:22
|
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.next.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.next.stderr
new file mode 100644
index 000000000..b5ace9ada
--- /dev/null
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.next.stderr
@@ -0,0 +1,17 @@
+error[E0053]: method `foo` has an incompatible type for trait
+ --> $DIR/async-example-desugared-boxed-in-trait.rs:17:28
+ |
+LL | async fn foo(&self) -> i32 {
+ | ^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
+ |
+note: type in trait
+ --> $DIR/async-example-desugared-boxed-in-trait.rs:13:22
+ |
+LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: expected signature `fn(&i32) -> Pin<Box<dyn Future<Output = i32>>>`
+ found signature `fn(&i32) -> impl Future<Output = i32>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs
index 38ba29718..7b53379b2 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs
@@ -1,4 +1,6 @@
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed.current.stderr
index 60fa534a6..6c0b58591 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.current.stderr
@@ -1,5 +1,5 @@
error: method `foo` should be async because the method from the trait is async
- --> $DIR/async-example-desugared-boxed.rs:15:5
+ --> $DIR/async-example-desugared-boxed.rs:17:5
|
LL | async fn foo(&self) -> i32;
| --------------------------- required because the trait method is async
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.next.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed.next.stderr
new file mode 100644
index 000000000..6c0b58591
--- /dev/null
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.next.stderr
@@ -0,0 +1,11 @@
+error: method `foo` should be async because the method from the trait is async
+ --> $DIR/async-example-desugared-boxed.rs:17:5
+ |
+LL | async fn foo(&self) -> i32;
+ | --------------------------- required because the trait method is async
+...
+LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs b/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs
index 1b1b3cffd..916488ffa 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs
@@ -1,4 +1,6 @@
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-extra.rs b/tests/ui/async-await/in-trait/async-example-desugared-extra.rs
index 81e1e59a3..edac0b374 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-extra.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-extra.rs
@@ -1,5 +1,7 @@
// check-pass
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs b/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs
index feeda719e..934f7643d 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs
@@ -1,5 +1,7 @@
// check-pass
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr b/tests/ui/async-await/in-trait/async-example-desugared-manual.current.stderr
index 567a36a86..0d2551ab8 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.current.stderr
@@ -1,5 +1,5 @@
error: method `foo` should be async because the method from the trait is async
- --> $DIR/async-example-desugared-manual.rs:23:5
+ --> $DIR/async-example-desugared-manual.rs:25:5
|
LL | async fn foo(&self) -> i32;
| --------------------------- required because the trait method is async
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.next.stderr b/tests/ui/async-await/in-trait/async-example-desugared-manual.next.stderr
new file mode 100644
index 000000000..0d2551ab8
--- /dev/null
+++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.next.stderr
@@ -0,0 +1,11 @@
+error: method `foo` should be async because the method from the trait is async
+ --> $DIR/async-example-desugared-manual.rs:25:5
+ |
+LL | async fn foo(&self) -> i32;
+ | --------------------------- required because the trait method is async
+...
+LL | fn foo(&self) -> MyFuture {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.rs b/tests/ui/async-await/in-trait/async-example-desugared-manual.rs
index 71473e745..4883828d3 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-manual.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.rs
@@ -1,4 +1,6 @@
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/async-await/in-trait/async-example-desugared.rs b/tests/ui/async-await/in-trait/async-example-desugared.rs
index fb92ec786..214171b2e 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared.rs
@@ -1,5 +1,7 @@
// check-pass
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr b/tests/ui/async-await/in-trait/async-generics-and-bounds.current.stderr
index f1f0d7e59..780da0689 100644
--- a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr
+++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.current.stderr
@@ -1,33 +1,33 @@
error[E0311]: the parameter type `U` may not live long enough
- --> $DIR/async-generics-and-bounds.rs:12:28
+ --> $DIR/async-generics-and-bounds.rs:14:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^
|
note: the parameter type `U` must be valid for the anonymous lifetime defined here...
- --> $DIR/async-generics-and-bounds.rs:12:18
+ --> $DIR/async-generics-and-bounds.rs:14:18
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics-and-bounds.rs:12:28
+ --> $DIR/async-generics-and-bounds.rs:14:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^
error[E0311]: the parameter type `T` may not live long enough
- --> $DIR/async-generics-and-bounds.rs:12:28
+ --> $DIR/async-generics-and-bounds.rs:14:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^
|
note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/async-generics-and-bounds.rs:12:18
+ --> $DIR/async-generics-and-bounds.rs:14:18
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics-and-bounds.rs:12:28
+ --> $DIR/async-generics-and-bounds.rs:14:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^
diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.next.stderr b/tests/ui/async-await/in-trait/async-generics-and-bounds.next.stderr
new file mode 100644
index 000000000..780da0689
--- /dev/null
+++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.next.stderr
@@ -0,0 +1,37 @@
+error[E0311]: the parameter type `U` may not live long enough
+ --> $DIR/async-generics-and-bounds.rs:14:28
+ |
+LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
+ | ^^^^^^^
+ |
+note: the parameter type `U` must be valid for the anonymous lifetime defined here...
+ --> $DIR/async-generics-and-bounds.rs:14:18
+ |
+LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
+ | ^^^^^
+note: ...so that the reference type `&(T, U)` does not outlive the data it points at
+ --> $DIR/async-generics-and-bounds.rs:14:28
+ |
+LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
+ | ^^^^^^^
+
+error[E0311]: the parameter type `T` may not live long enough
+ --> $DIR/async-generics-and-bounds.rs:14:28
+ |
+LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
+ | ^^^^^^^
+ |
+note: the parameter type `T` must be valid for the anonymous lifetime defined here...
+ --> $DIR/async-generics-and-bounds.rs:14:18
+ |
+LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
+ | ^^^^^
+note: ...so that the reference type `&(T, U)` does not outlive the data it points at
+ --> $DIR/async-generics-and-bounds.rs:14:28
+ |
+LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
+ | ^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0311`.
diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.rs b/tests/ui/async-await/in-trait/async-generics-and-bounds.rs
index a73d55adf..146e74ec2 100644
--- a/tests/ui/async-await/in-trait/async-generics-and-bounds.rs
+++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.rs
@@ -1,6 +1,8 @@
// check-fail
// known-bug: #102682
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/async-generics.stderr b/tests/ui/async-await/in-trait/async-generics.current.stderr
index 2f0556456..04e1ab6d7 100644
--- a/tests/ui/async-await/in-trait/async-generics.stderr
+++ b/tests/ui/async-await/in-trait/async-generics.current.stderr
@@ -1,33 +1,33 @@
error[E0311]: the parameter type `U` may not live long enough
- --> $DIR/async-generics.rs:9:28
+ --> $DIR/async-generics.rs:11:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^
|
note: the parameter type `U` must be valid for the anonymous lifetime defined here...
- --> $DIR/async-generics.rs:9:18
+ --> $DIR/async-generics.rs:11:18
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics.rs:9:28
+ --> $DIR/async-generics.rs:11:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^
error[E0311]: the parameter type `T` may not live long enough
- --> $DIR/async-generics.rs:9:28
+ --> $DIR/async-generics.rs:11:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^
|
note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/async-generics.rs:9:18
+ --> $DIR/async-generics.rs:11:18
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics.rs:9:28
+ --> $DIR/async-generics.rs:11:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^
diff --git a/tests/ui/async-await/in-trait/async-generics.next.stderr b/tests/ui/async-await/in-trait/async-generics.next.stderr
new file mode 100644
index 000000000..04e1ab6d7
--- /dev/null
+++ b/tests/ui/async-await/in-trait/async-generics.next.stderr
@@ -0,0 +1,37 @@
+error[E0311]: the parameter type `U` may not live long enough
+ --> $DIR/async-generics.rs:11:28
+ |
+LL | async fn foo(&self) -> &(T, U);
+ | ^^^^^^^
+ |
+note: the parameter type `U` must be valid for the anonymous lifetime defined here...
+ --> $DIR/async-generics.rs:11:18
+ |
+LL | async fn foo(&self) -> &(T, U);
+ | ^^^^^
+note: ...so that the reference type `&(T, U)` does not outlive the data it points at
+ --> $DIR/async-generics.rs:11:28
+ |
+LL | async fn foo(&self) -> &(T, U);
+ | ^^^^^^^
+
+error[E0311]: the parameter type `T` may not live long enough
+ --> $DIR/async-generics.rs:11:28
+ |
+LL | async fn foo(&self) -> &(T, U);
+ | ^^^^^^^
+ |
+note: the parameter type `T` must be valid for the anonymous lifetime defined here...
+ --> $DIR/async-generics.rs:11:18
+ |
+LL | async fn foo(&self) -> &(T, U);
+ | ^^^^^
+note: ...so that the reference type `&(T, U)` does not outlive the data it points at
+ --> $DIR/async-generics.rs:11:28
+ |
+LL | async fn foo(&self) -> &(T, U);
+ | ^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0311`.
diff --git a/tests/ui/async-await/in-trait/async-generics.rs b/tests/ui/async-await/in-trait/async-generics.rs
index 67000e577..507500abf 100644
--- a/tests/ui/async-await/in-trait/async-generics.rs
+++ b/tests/ui/async-await/in-trait/async-generics.rs
@@ -1,6 +1,8 @@
// check-fail
// known-bug: #102682
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/async-recursive-generic.stderr b/tests/ui/async-await/in-trait/async-recursive-generic.current.stderr
index cab173bdd..67b491f19 100644
--- a/tests/ui/async-await/in-trait/async-recursive-generic.stderr
+++ b/tests/ui/async-await/in-trait/async-recursive-generic.current.stderr
@@ -1,5 +1,5 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/async-recursive-generic.rs:11:48
+ --> $DIR/async-recursive-generic.rs:13:48
|
LL | async fn foo_recursive(&self, n: usize) -> T {
| ^ recursive `async fn`
diff --git a/tests/ui/async-await/in-trait/async-recursive-generic.next.stderr b/tests/ui/async-await/in-trait/async-recursive-generic.next.stderr
new file mode 100644
index 000000000..67b491f19
--- /dev/null
+++ b/tests/ui/async-await/in-trait/async-recursive-generic.next.stderr
@@ -0,0 +1,12 @@
+error[E0733]: recursion in an `async fn` requires boxing
+ --> $DIR/async-recursive-generic.rs:13:48
+ |
+LL | async fn foo_recursive(&self, n: usize) -> T {
+ | ^ recursive `async fn`
+ |
+ = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
+ = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0733`.
diff --git a/tests/ui/async-await/in-trait/async-recursive-generic.rs b/tests/ui/async-await/in-trait/async-recursive-generic.rs
index 6839abd38..64c6ba15c 100644
--- a/tests/ui/async-await/in-trait/async-recursive-generic.rs
+++ b/tests/ui/async-await/in-trait/async-recursive-generic.rs
@@ -1,4 +1,6 @@
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/async-recursive.stderr b/tests/ui/async-await/in-trait/async-recursive.current.stderr
index 9feff37b3..85af27e37 100644
--- a/tests/ui/async-await/in-trait/async-recursive.stderr
+++ b/tests/ui/async-await/in-trait/async-recursive.current.stderr
@@ -1,5 +1,5 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/async-recursive.rs:11:48
+ --> $DIR/async-recursive.rs:13:48
|
LL | async fn foo_recursive(&self, n: usize) -> i32 {
| ^^^ recursive `async fn`
diff --git a/tests/ui/async-await/in-trait/async-recursive.next.stderr b/tests/ui/async-await/in-trait/async-recursive.next.stderr
new file mode 100644
index 000000000..85af27e37
--- /dev/null
+++ b/tests/ui/async-await/in-trait/async-recursive.next.stderr
@@ -0,0 +1,12 @@
+error[E0733]: recursion in an `async fn` requires boxing
+ --> $DIR/async-recursive.rs:13:48
+ |
+LL | async fn foo_recursive(&self, n: usize) -> i32 {
+ | ^^^ recursive `async fn`
+ |
+ = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
+ = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0733`.
diff --git a/tests/ui/async-await/in-trait/async-recursive.rs b/tests/ui/async-await/in-trait/async-recursive.rs
index 61119f809..d928909e3 100644
--- a/tests/ui/async-await/in-trait/async-recursive.rs
+++ b/tests/ui/async-await/in-trait/async-recursive.rs
@@ -1,4 +1,6 @@
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/bad-signatures.stderr b/tests/ui/async-await/in-trait/bad-signatures.current.stderr
index e0ba7b53e..5a05b080c 100644
--- a/tests/ui/async-await/in-trait/bad-signatures.stderr
+++ b/tests/ui/async-await/in-trait/bad-signatures.current.stderr
@@ -1,11 +1,11 @@
error: expected identifier, found keyword `self`
- --> $DIR/bad-signatures.rs:7:23
+ --> $DIR/bad-signatures.rs:9:23
|
LL | async fn bar(&abc self);
| ^^^^ expected identifier, found keyword
error: expected one of `:`, `@`, or `|`, found keyword `self`
- --> $DIR/bad-signatures.rs:7:23
+ --> $DIR/bad-signatures.rs:9:23
|
LL | async fn bar(&abc self);
| -----^^^^
@@ -14,7 +14,7 @@ LL | async fn bar(&abc self);
| help: declare the type after the parameter binding: `<identifier>: <type>`
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/bad-signatures.rs:3:12
+ --> $DIR/bad-signatures.rs:5:12
|
LL | #![feature(async_fn_in_trait)]
| ^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/async-await/in-trait/bad-signatures.next.stderr b/tests/ui/async-await/in-trait/bad-signatures.next.stderr
new file mode 100644
index 000000000..5a05b080c
--- /dev/null
+++ b/tests/ui/async-await/in-trait/bad-signatures.next.stderr
@@ -0,0 +1,26 @@
+error: expected identifier, found keyword `self`
+ --> $DIR/bad-signatures.rs:9:23
+ |
+LL | async fn bar(&abc self);
+ | ^^^^ expected identifier, found keyword
+
+error: expected one of `:`, `@`, or `|`, found keyword `self`
+ --> $DIR/bad-signatures.rs:9:23
+ |
+LL | async fn bar(&abc self);
+ | -----^^^^
+ | | |
+ | | expected one of `:`, `@`, or `|`
+ | help: declare the type after the parameter binding: `<identifier>: <type>`
+
+warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/bad-signatures.rs:5:12
+ |
+LL | #![feature(async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: aborting due to 2 previous errors; 1 warning emitted
+
diff --git a/tests/ui/async-await/in-trait/bad-signatures.rs b/tests/ui/async-await/in-trait/bad-signatures.rs
index b86f1d1c1..e0093be8c 100644
--- a/tests/ui/async-await/in-trait/bad-signatures.rs
+++ b/tests/ui/async-await/in-trait/bad-signatures.rs
@@ -1,4 +1,6 @@
// edition:2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
//~^ WARN the feature `async_fn_in_trait` is incomplete
diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.current.stderr
index f71fd9980..1e67cdca2 100644
--- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr
+++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.current.stderr
@@ -1,5 +1,5 @@
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/dont-project-to-specializable-projection.rs:4:12
+ --> $DIR/dont-project-to-specializable-projection.rs:6:12
|
LL | #![feature(async_fn_in_trait)]
| ^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #![feature(async_fn_in_trait)]
= note: `#[warn(incomplete_features)]` on by default
error: async associated function in trait cannot be specialized
- --> $DIR/dont-project-to-specializable-projection.rs:14:5
+ --> $DIR/dont-project-to-specializable-projection.rs:16:5
|
LL | default async fn foo(_: T) -> &'static str {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.next.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.next.stderr
new file mode 100644
index 000000000..fa89c6b77
--- /dev/null
+++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.next.stderr
@@ -0,0 +1,34 @@
+warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/dont-project-to-specializable-projection.rs:6:12
+ |
+LL | #![feature(async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0053]: method `foo` has an incompatible type for trait
+ --> $DIR/dont-project-to-specializable-projection.rs:16:35
+ |
+LL | default async fn foo(_: T) -> &'static str {
+ | ^^^^^^^^^^^^ expected associated type, found future
+ |
+note: type in trait
+ --> $DIR/dont-project-to-specializable-projection.rs:12:27
+ |
+LL | async fn foo(_: T) -> &'static str;
+ | ^^^^^^^^^^^^
+ = note: expected signature `fn(_) -> impl Future<Output = &'static str>`
+ found signature `fn(_) -> impl Future<Output = &'static str>`
+
+error: async associated function in trait cannot be specialized
+ --> $DIR/dont-project-to-specializable-projection.rs:16:5
+ |
+LL | default async fn foo(_: T) -> &'static str {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: specialization behaves in inconsistent and surprising ways with `#![feature(async_fn_in_trait)]`, and for now is disallowed
+
+error: aborting due to 2 previous errors; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
index afd3db5e0..7183eaccc 100644
--- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
+++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
@@ -1,5 +1,7 @@
// edition: 2021
// known-bug: #108309
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(min_specialization)]
diff --git a/tests/ui/async-await/in-trait/early-bound-1.rs b/tests/ui/async-await/in-trait/early-bound-1.rs
index 6b3b14201..30843473d 100644
--- a/tests/ui/async-await/in-trait/early-bound-1.rs
+++ b/tests/ui/async-await/in-trait/early-bound-1.rs
@@ -1,5 +1,7 @@
// check-pass
// edition:2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/early-bound-2.rs b/tests/ui/async-await/in-trait/early-bound-2.rs
index 270443229..1c5a68c2a 100644
--- a/tests/ui/async-await/in-trait/early-bound-2.rs
+++ b/tests/ui/async-await/in-trait/early-bound-2.rs
@@ -1,5 +1,7 @@
// check-pass
// edition:2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.stderr b/tests/ui/async-await/in-trait/fn-not-async-err2.current.stderr
index 37d9669c0..1a7495149 100644
--- a/tests/ui/async-await/in-trait/fn-not-async-err2.stderr
+++ b/tests/ui/async-await/in-trait/fn-not-async-err2.current.stderr
@@ -1,5 +1,5 @@
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
- --> $DIR/fn-not-async-err2.rs:13:22
+ --> $DIR/fn-not-async-err2.rs:15:22
|
LL | fn foo(&self) -> impl Future<Output = i32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.next.stderr b/tests/ui/async-await/in-trait/fn-not-async-err2.next.stderr
new file mode 100644
index 000000000..1a7495149
--- /dev/null
+++ b/tests/ui/async-await/in-trait/fn-not-async-err2.next.stderr
@@ -0,0 +1,12 @@
+error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
+ --> $DIR/fn-not-async-err2.rs:15:22
+ |
+LL | fn foo(&self) -> impl Future<Output = i32> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0562`.
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.rs b/tests/ui/async-await/in-trait/fn-not-async-err2.rs
index 78017429f..5fdb7296a 100644
--- a/tests/ui/async-await/in-trait/fn-not-async-err2.rs
+++ b/tests/ui/async-await/in-trait/fn-not-async-err2.rs
@@ -1,4 +1,6 @@
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/generics-mismatch.current.stderr b/tests/ui/async-await/in-trait/generics-mismatch.current.stderr
new file mode 100644
index 000000000..be23384e0
--- /dev/null
+++ b/tests/ui/async-await/in-trait/generics-mismatch.current.stderr
@@ -0,0 +1,16 @@
+error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo`
+ --> $DIR/generics-mismatch.rs:13:18
+ |
+LL | trait Foo {
+ | ---
+LL | async fn foo<T>();
+ | - expected type parameter
+...
+LL | impl Foo for () {
+ | ---------------
+LL | async fn foo<const N: usize>() {}
+ | ^^^^^^^^^^^^^^ found const parameter of type `usize`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/tests/ui/async-await/in-trait/generics-mismatch.next.stderr b/tests/ui/async-await/in-trait/generics-mismatch.next.stderr
new file mode 100644
index 000000000..be23384e0
--- /dev/null
+++ b/tests/ui/async-await/in-trait/generics-mismatch.next.stderr
@@ -0,0 +1,16 @@
+error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo`
+ --> $DIR/generics-mismatch.rs:13:18
+ |
+LL | trait Foo {
+ | ---
+LL | async fn foo<T>();
+ | - expected type parameter
+...
+LL | impl Foo for () {
+ | ---------------
+LL | async fn foo<const N: usize>() {}
+ | ^^^^^^^^^^^^^^ found const parameter of type `usize`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/tests/ui/async-await/in-trait/generics-mismatch.rs b/tests/ui/async-await/in-trait/generics-mismatch.rs
new file mode 100644
index 000000000..fc29783c0
--- /dev/null
+++ b/tests/ui/async-await/in-trait/generics-mismatch.rs
@@ -0,0 +1,15 @@
+// edition: 2021
+
+#![feature(async_fn_in_trait)]
+#![allow(incomplete_features)]
+
+trait Foo {
+ async fn foo<T>();
+}
+
+impl Foo for () {
+ async fn foo<const N: usize>() {}
+ //~^ ERROR: method `foo` has an incompatible generic parameter for trait `Foo` [E0053]
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/generics-mismatch.stderr b/tests/ui/async-await/in-trait/generics-mismatch.stderr
new file mode 100644
index 000000000..3518aa05c
--- /dev/null
+++ b/tests/ui/async-await/in-trait/generics-mismatch.stderr
@@ -0,0 +1,16 @@
+error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo`
+ --> $DIR/generics-mismatch.rs:11:18
+ |
+LL | trait Foo {
+ | ---
+LL | async fn foo<T>();
+ | - expected type parameter
+...
+LL | impl Foo for () {
+ | ---------------
+LL | async fn foo<const N: usize>() {}
+ | ^^^^^^^^^^^^^^ found const parameter of type `usize`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/tests/ui/async-await/in-trait/implied-bounds.rs b/tests/ui/async-await/in-trait/implied-bounds.rs
index 52bceb3cc..45ada1d84 100644
--- a/tests/ui/async-await/in-trait/implied-bounds.rs
+++ b/tests/ui/async-await/in-trait/implied-bounds.rs
@@ -1,5 +1,7 @@
// check-pass
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/issue-102138.rs b/tests/ui/async-await/in-trait/issue-102138.rs
index f61b34ed9..ced30b7e4 100644
--- a/tests/ui/async-await/in-trait/issue-102138.rs
+++ b/tests/ui/async-await/in-trait/issue-102138.rs
@@ -1,5 +1,7 @@
// check-pass
// edition:2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/issue-102219.rs b/tests/ui/async-await/in-trait/issue-102219.rs
index 9a35f6515..f3fdfa345 100644
--- a/tests/ui/async-await/in-trait/issue-102219.rs
+++ b/tests/ui/async-await/in-trait/issue-102219.rs
@@ -1,6 +1,8 @@
// compile-flags:--crate-type=lib
// edition:2021
// check-pass
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/issue-102310.rs b/tests/ui/async-await/in-trait/issue-102310.rs
index 49c3e9fee..8e5dbd08e 100644
--- a/tests/ui/async-await/in-trait/issue-102310.rs
+++ b/tests/ui/async-await/in-trait/issue-102310.rs
@@ -1,5 +1,7 @@
// check-pass
// edition:2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/issue-104678.rs b/tests/ui/async-await/in-trait/issue-104678.rs
index e396df4e5..3d010f180 100644
--- a/tests/ui/async-await/in-trait/issue-104678.rs
+++ b/tests/ui/async-await/in-trait/issue-104678.rs
@@ -1,5 +1,7 @@
// edition:2021
// check-pass
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.stderr b/tests/ui/async-await/in-trait/lifetime-mismatch.current.stderr
index d87adcc78..0e9477544 100644
--- a/tests/ui/async-await/in-trait/lifetime-mismatch.stderr
+++ b/tests/ui/async-await/in-trait/lifetime-mismatch.current.stderr
@@ -1,5 +1,5 @@
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/lifetime-mismatch.rs:3:12
+ --> $DIR/lifetime-mismatch.rs:5:12
|
LL | #![feature(async_fn_in_trait)]
| ^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #![feature(async_fn_in_trait)]
= note: `#[warn(incomplete_features)]` on by default
error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
- --> $DIR/lifetime-mismatch.rs:12:17
+ --> $DIR/lifetime-mismatch.rs:14:17
|
LL | async fn foo<'a>(&self);
| ---- lifetimes in impl do not match this method in trait
diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.next.stderr b/tests/ui/async-await/in-trait/lifetime-mismatch.next.stderr
new file mode 100644
index 000000000..0e9477544
--- /dev/null
+++ b/tests/ui/async-await/in-trait/lifetime-mismatch.next.stderr
@@ -0,0 +1,21 @@
+warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/lifetime-mismatch.rs:5:12
+ |
+LL | #![feature(async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
+ --> $DIR/lifetime-mismatch.rs:14:17
+ |
+LL | async fn foo<'a>(&self);
+ | ---- lifetimes in impl do not match this method in trait
+...
+LL | async fn foo(&self) {}
+ | ^ lifetimes do not match method in trait
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0195`.
diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.rs b/tests/ui/async-await/in-trait/lifetime-mismatch.rs
index 45ede193c..5ff5a01a1 100644
--- a/tests/ui/async-await/in-trait/lifetime-mismatch.rs
+++ b/tests/ui/async-await/in-trait/lifetime-mismatch.rs
@@ -1,4 +1,6 @@
// edition:2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
//~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
diff --git a/tests/ui/async-await/in-trait/missing-send-bound.stderr b/tests/ui/async-await/in-trait/missing-send-bound.current.stderr
index 5cedf3ddb..319ed582e 100644
--- a/tests/ui/async-await/in-trait/missing-send-bound.stderr
+++ b/tests/ui/async-await/in-trait/missing-send-bound.current.stderr
@@ -1,5 +1,5 @@
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/missing-send-bound.rs:3:12
+ --> $DIR/missing-send-bound.rs:5:12
|
LL | #![feature(async_fn_in_trait)]
| ^^^^^^^^^^^^^^^^^
@@ -8,19 +8,19 @@ LL | #![feature(async_fn_in_trait)]
= note: `#[warn(incomplete_features)]` on by default
error: future cannot be sent between threads safely
- --> $DIR/missing-send-bound.rs:15:20
+ --> $DIR/missing-send-bound.rs:17:20
|
LL | assert_is_send(test::<T>());
| ^^^^^^^^^^^ future returned by `test` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `impl Future<Output = ()>`
note: future is not `Send` as it awaits another future which is not `Send`
- --> $DIR/missing-send-bound.rs:11:5
+ --> $DIR/missing-send-bound.rs:13:5
|
LL | T::bar().await;
| ^^^^^^^^ await occurs here on type `impl Future<Output = ()>`, which is not `Send`
note: required by a bound in `assert_is_send`
- --> $DIR/missing-send-bound.rs:19:27
+ --> $DIR/missing-send-bound.rs:21:27
|
LL | fn assert_is_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_is_send`
diff --git a/tests/ui/async-await/in-trait/missing-send-bound.next.stderr b/tests/ui/async-await/in-trait/missing-send-bound.next.stderr
new file mode 100644
index 000000000..319ed582e
--- /dev/null
+++ b/tests/ui/async-await/in-trait/missing-send-bound.next.stderr
@@ -0,0 +1,29 @@
+warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/missing-send-bound.rs:5:12
+ |
+LL | #![feature(async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: future cannot be sent between threads safely
+ --> $DIR/missing-send-bound.rs:17:20
+ |
+LL | assert_is_send(test::<T>());
+ | ^^^^^^^^^^^ future returned by `test` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `impl Future<Output = ()>`
+note: future is not `Send` as it awaits another future which is not `Send`
+ --> $DIR/missing-send-bound.rs:13:5
+ |
+LL | T::bar().await;
+ | ^^^^^^^^ await occurs here on type `impl Future<Output = ()>`, which is not `Send`
+note: required by a bound in `assert_is_send`
+ --> $DIR/missing-send-bound.rs:21:27
+ |
+LL | fn assert_is_send(_: impl Send) {}
+ | ^^^^ required by this bound in `assert_is_send`
+
+error: aborting due to previous error; 1 warning emitted
+
diff --git a/tests/ui/async-await/in-trait/missing-send-bound.rs b/tests/ui/async-await/in-trait/missing-send-bound.rs
index 78922b59b..705fcf322 100644
--- a/tests/ui/async-await/in-trait/missing-send-bound.rs
+++ b/tests/ui/async-await/in-trait/missing-send-bound.rs
@@ -1,4 +1,6 @@
// edition:2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
//~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
diff --git a/tests/ui/async-await/in-trait/object-safety.stderr b/tests/ui/async-await/in-trait/object-safety.current.stderr
index 0b318f71f..90e049a99 100644
--- a/tests/ui/async-await/in-trait/object-safety.stderr
+++ b/tests/ui/async-await/in-trait/object-safety.current.stderr
@@ -1,5 +1,5 @@
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/object-safety.rs:3:12
+ --> $DIR/object-safety.rs:5:12
|
LL | #![feature(async_fn_in_trait)]
| ^^^^^^^^^^^^^^^^^
@@ -8,13 +8,13 @@ LL | #![feature(async_fn_in_trait)]
= note: `#[warn(incomplete_features)]` on by default
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:11:12
+ --> $DIR/object-safety.rs:13:12
|
LL | let x: &dyn Foo = todo!();
| ^^^^^^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:7:14
+ --> $DIR/object-safety.rs:9:14
|
LL | trait Foo {
| --- this trait cannot be made into an object...
diff --git a/tests/ui/async-await/in-trait/object-safety.next.stderr b/tests/ui/async-await/in-trait/object-safety.next.stderr
new file mode 100644
index 000000000..90e049a99
--- /dev/null
+++ b/tests/ui/async-await/in-trait/object-safety.next.stderr
@@ -0,0 +1,27 @@
+warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/object-safety.rs:5:12
+ |
+LL | #![feature(async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0038]: the trait `Foo` cannot be made into an object
+ --> $DIR/object-safety.rs:13:12
+ |
+LL | let x: &dyn Foo = todo!();
+ | ^^^^^^^^ `Foo` cannot be made into an object
+ |
+note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
+ --> $DIR/object-safety.rs:9:14
+ |
+LL | trait Foo {
+ | --- this trait cannot be made into an object...
+LL | async fn foo(&self);
+ | ^^^ ...because method `foo` is `async`
+ = help: consider moving `foo` to another trait
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/async-await/in-trait/object-safety.rs b/tests/ui/async-await/in-trait/object-safety.rs
index a8bc35f7e..f67286a20 100644
--- a/tests/ui/async-await/in-trait/object-safety.rs
+++ b/tests/ui/async-await/in-trait/object-safety.rs
@@ -1,4 +1,6 @@
// edition:2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
//~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.stderr b/tests/ui/async-await/in-trait/return-type-suggestion.current.stderr
index b8d83d0f2..a5efc7571 100644
--- a/tests/ui/async-await/in-trait/return-type-suggestion.stderr
+++ b/tests/ui/async-await/in-trait/return-type-suggestion.current.stderr
@@ -1,5 +1,5 @@
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/return-type-suggestion.rs:3:12
+ --> $DIR/return-type-suggestion.rs:5:12
|
LL | #![feature(async_fn_in_trait)]
| ^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #![feature(async_fn_in_trait)]
= note: `#[warn(incomplete_features)]` on by default
error[E0308]: mismatched types
- --> $DIR/return-type-suggestion.rs:8:9
+ --> $DIR/return-type-suggestion.rs:10:9
|
LL | Ok(())
| ^^^^^^- help: consider using a semicolon here: `;`
diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.next.stderr b/tests/ui/async-await/in-trait/return-type-suggestion.next.stderr
new file mode 100644
index 000000000..a5efc7571
--- /dev/null
+++ b/tests/ui/async-await/in-trait/return-type-suggestion.next.stderr
@@ -0,0 +1,23 @@
+warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/return-type-suggestion.rs:5:12
+ |
+LL | #![feature(async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0308]: mismatched types
+ --> $DIR/return-type-suggestion.rs:10:9
+ |
+LL | Ok(())
+ | ^^^^^^- help: consider using a semicolon here: `;`
+ | |
+ | expected `()`, found `Result<(), _>`
+ |
+ = note: expected unit type `()`
+ found enum `Result<(), _>`
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.rs b/tests/ui/async-await/in-trait/return-type-suggestion.rs
index 3446761d1..3de66306d 100644
--- a/tests/ui/async-await/in-trait/return-type-suggestion.rs
+++ b/tests/ui/async-await/in-trait/return-type-suggestion.rs
@@ -1,4 +1,6 @@
// edition: 2021
+// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: current next
#![feature(async_fn_in_trait)]
//~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
diff --git a/tests/ui/async-await/issue-108572.rs b/tests/ui/async-await/issue-108572.rs
new file mode 100644
index 000000000..efcb8b8eb
--- /dev/null
+++ b/tests/ui/async-await/issue-108572.rs
@@ -0,0 +1,12 @@
+// edition: 2021
+
+use std::future::Future;
+fn foo() -> impl Future<Output=()> {
+ async { }
+}
+
+fn main() {
+ let fut = foo();
+ fut.poll();
+ //~^ ERROR no method named `poll` found for opaque type `impl Future<Output = ()>` in the current scope [E0599]
+}
diff --git a/tests/ui/async-await/issue-108572.stderr b/tests/ui/async-await/issue-108572.stderr
new file mode 100644
index 000000000..0dbcf4d66
--- /dev/null
+++ b/tests/ui/async-await/issue-108572.stderr
@@ -0,0 +1,12 @@
+error[E0599]: no method named `poll` found for opaque type `impl Future<Output = ()>` in the current scope
+ --> $DIR/issue-108572.rs:10:9
+ |
+LL | fut.poll();
+ | ^^^^ method not found in `impl Future<Output = ()>`
+ |
+ = help: method `poll` found on `Pin<&mut impl Future<Output = ()>>`, see documentation for `std::pin::Pin`
+ = help: self type must be pinned to call `Future::poll`, see https://rust-lang.github.io/async-book/04_pinning/01_chapter.html#pinning-in-practice
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/async-await/large_moves.attribute.stderr b/tests/ui/async-await/large_moves.attribute.stderr
index 0c5452475..94f61caa2 100644
--- a/tests/ui/async-await/large_moves.attribute.stderr
+++ b/tests/ui/async-await/large_moves.attribute.stderr
@@ -1,14 +1,8 @@
error: moving 10024 bytes
- --> $DIR/large_moves.rs:13:13
+ --> $DIR/large_moves.rs:19:14
|
-LL | let x = async {
- | _____________^
-LL | | let y = [0; 9999];
-LL | | dbg!(y);
-LL | | thing(&y).await;
-LL | | dbg!(y);
-LL | | };
- | |_____^ value moved from here
+LL | let z = (x, 42);
+ | ^ value moved from here
|
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
note: the lint level is defined here
@@ -18,14 +12,6 @@ LL | #![deny(large_assignments)]
| ^^^^^^^^^^^^^^^^^
error: moving 10024 bytes
- --> $DIR/large_moves.rs:19:14
- |
-LL | let z = (x, 42);
- | ^ value moved from here
- |
- = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
-
-error: moving 10024 bytes
--> $DIR/large_moves.rs:19:13
|
LL | let z = (x, 42);
@@ -41,5 +27,5 @@ LL | let a = z.0;
|
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
diff --git a/tests/ui/async-await/large_moves.option.stderr b/tests/ui/async-await/large_moves.option.stderr
index 0c5452475..94f61caa2 100644
--- a/tests/ui/async-await/large_moves.option.stderr
+++ b/tests/ui/async-await/large_moves.option.stderr
@@ -1,14 +1,8 @@
error: moving 10024 bytes
- --> $DIR/large_moves.rs:13:13
+ --> $DIR/large_moves.rs:19:14
|
-LL | let x = async {
- | _____________^
-LL | | let y = [0; 9999];
-LL | | dbg!(y);
-LL | | thing(&y).await;
-LL | | dbg!(y);
-LL | | };
- | |_____^ value moved from here
+LL | let z = (x, 42);
+ | ^ value moved from here
|
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
note: the lint level is defined here
@@ -18,14 +12,6 @@ LL | #![deny(large_assignments)]
| ^^^^^^^^^^^^^^^^^
error: moving 10024 bytes
- --> $DIR/large_moves.rs:19:14
- |
-LL | let z = (x, 42);
- | ^ value moved from here
- |
- = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
-
-error: moving 10024 bytes
--> $DIR/large_moves.rs:19:13
|
LL | let z = (x, 42);
@@ -41,5 +27,5 @@ LL | let a = z.0;
|
= note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
diff --git a/tests/ui/async-await/large_moves.rs b/tests/ui/async-await/large_moves.rs
index d43d0eec0..c8ed6bafe 100644
--- a/tests/ui/async-await/large_moves.rs
+++ b/tests/ui/async-await/large_moves.rs
@@ -10,7 +10,7 @@
// compile-flags: -Zmir-opt-level=0
fn main() {
- let x = async { //~ ERROR large_assignments
+ let x = async {
let y = [0; 9999];
dbg!(y);
thing(&y).await;
diff --git a/tests/ui/async-await/missed-capture-issue-107414.rs b/tests/ui/async-await/missed-capture-issue-107414.rs
new file mode 100644
index 000000000..0ab4f5ade
--- /dev/null
+++ b/tests/ui/async-await/missed-capture-issue-107414.rs
@@ -0,0 +1,24 @@
+// check-pass
+// edition:2018
+
+fn main() {}
+
+struct StructA {}
+struct StructB {}
+
+impl StructA {
+ fn fn_taking_struct_b(&self, struct_b: &StructB) -> bool {
+ true
+ }
+}
+
+async fn get_struct_a_async() -> StructA {
+ StructA {}
+}
+
+async fn ice() {
+ match Some(StructB {}) {
+ Some(struct_b) if get_struct_a_async().await.fn_taking_struct_b(&struct_b) => {}
+ _ => {}
+ }
+}
diff --git a/tests/ui/async-await/no-const-async.rs b/tests/ui/async-await/no-const-async.rs
index cfb0ef1b3..b3c59734e 100644
--- a/tests/ui/async-await/no-const-async.rs
+++ b/tests/ui/async-await/no-const-async.rs
@@ -3,4 +3,3 @@
pub const async fn x() {}
//~^ ERROR functions cannot be both `const` and `async`
-//~| ERROR cycle detected
diff --git a/tests/ui/async-await/no-const-async.stderr b/tests/ui/async-await/no-const-async.stderr
index 71c228958..90ec646c8 100644
--- a/tests/ui/async-await/no-const-async.stderr
+++ b/tests/ui/async-await/no-const-async.stderr
@@ -7,36 +7,5 @@ LL | pub const async fn x() {}
| | `async` because of this
| `const` because of this
-error[E0391]: cycle detected when computing type of `x::{opaque#0}`
- --> $DIR/no-const-async.rs:4:24
- |
-LL | pub const async fn x() {}
- | ^
- |
-note: ...which requires borrow-checking `x`...
- --> $DIR/no-const-async.rs:4:1
- |
-LL | pub const async fn x() {}
- | ^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires processing MIR for `x`...
- --> $DIR/no-const-async.rs:4:1
- |
-LL | pub const async fn x() {}
- | ^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires const checking `x`...
- --> $DIR/no-const-async.rs:4:1
- |
-LL | pub const async fn x() {}
- | ^^^^^^^^^^^^^^^^^^^^^^
- = note: ...which requires computing whether `x::{opaque#0}` is freeze...
- = note: ...which requires evaluating trait selection obligation `x::{opaque#0}: core::marker::Freeze`...
- = note: ...which again requires computing type of `x::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in top-level module
- --> $DIR/no-const-async.rs:4:1
- |
-LL | pub const async fn x() {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/async-await/pin-needed-to-poll-2.stderr b/tests/ui/async-await/pin-needed-to-poll-2.stderr
index 0a6f705e2..61126faf8 100644
--- a/tests/ui/async-await/pin-needed-to-poll-2.stderr
+++ b/tests/ui/async-await/pin-needed-to-poll-2.stderr
@@ -6,7 +6,8 @@ LL | Pin::new(&mut self.sleep).poll(cx)
| |
| required by a bound introduced by this call
|
- = note: consider using `Box::pin`
+ = note: consider using the `pin!` macro
+ consider using `Box::pin` if you need to access the pinned value outside of the current scope
note: required because it appears within the type `Sleep`
--> $DIR/pin-needed-to-poll-2.rs:8:8
|
diff --git a/tests/ui/async-await/task-context-arg.rs b/tests/ui/async-await/task-context-arg.rs
new file mode 100644
index 000000000..937723ca7
--- /dev/null
+++ b/tests/ui/async-await/task-context-arg.rs
@@ -0,0 +1,25 @@
+// Checks that we don't get conflicting arguments in our debug info with a particular async function
+// structure.
+
+// edition:2021
+// compile-flags: -Cdebuginfo=2
+// build-pass
+
+#![crate_type = "lib"]
+
+use std::future::Future;
+
+// The compiler produces a closure as part of this function. That closure initially takes an
+// argument _task_context. Later, when the MIR for that closure is transformed into a generator
+// state machine, _task_context is demoted to not be an argument, but just part of an unnamed
+// argument. If we emit debug info saying that both _task_context and the unnamed argument are both
+// argument number 2, then LLVM will fail with "conflicting debug info for argument". See
+// https://github.com/rust-lang/rust/pull/109466#issuecomment-1500879195 for details.
+async fn recv_unit() {
+ std::future::ready(()).await;
+}
+
+pub fn poll_recv() {
+ // This box is necessary in order to reproduce the problem.
+ let _: Box<dyn Future<Output = ()>> = Box::new(recv_unit());
+}
diff --git a/tests/ui/async-await/track-caller/async-block.rs b/tests/ui/async-await/track-caller/async-block.rs
index 8e81387c3..8ddd4ab11 100644
--- a/tests/ui/async-await/track-caller/async-block.rs
+++ b/tests/ui/async-await/track-caller/async-block.rs
@@ -1,9 +1,9 @@
// edition:2021
-#![feature(closure_track_caller, stmt_expr_attributes)]
+#![feature(stmt_expr_attributes)]
fn main() {
let _ = #[track_caller] async {
- //~^ ERROR attribute should be applied to a function definition [E0739]
+ //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
};
}
diff --git a/tests/ui/async-await/track-caller/async-block.stderr b/tests/ui/async-await/track-caller/async-block.stderr
index 407439921..21d1054d2 100644
--- a/tests/ui/async-await/track-caller/async-block.stderr
+++ b/tests/ui/async-await/track-caller/async-block.stderr
@@ -1,12 +1,12 @@
-error[E0739]: attribute should be applied to a function definition
+error[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-block.rs:6:13
|
-LL | let _ = #[track_caller] async {
- | _____________^^^^^^^^^^^^^^^_-
-LL | |
-LL | | };
- | |_____- not a function definition
+LL | let _ = #[track_caller] async {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0739`.
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/track-caller/panic-track-caller.rs b/tests/ui/async-await/track-caller/panic-track-caller.rs
index f45243b0e..65bb23e0b 100644
--- a/tests/ui/async-await/track-caller/panic-track-caller.rs
+++ b/tests/ui/async-await/track-caller/panic-track-caller.rs
@@ -79,6 +79,16 @@ async fn foo_closure() {
c().await
}
+// Since compilation is expected to fail for this fn when using
+// `nofeat`, we test that separately in `async-block.rs`
+#[cfg(feat)]
+async fn foo_block() {
+ let a = #[track_caller] async {
+ panic!();
+ };
+ a.await
+}
+
fn panicked_at(f: impl FnOnce() + panic::UnwindSafe) -> u32 {
let loc = Arc::new(Mutex::new(None));
@@ -110,4 +120,7 @@ fn main() {
#[cfg(feat)]
assert_eq!(panicked_at(|| block_on(foo_closure())), 79);
+
+ #[cfg(feat)]
+ assert_eq!(panicked_at(|| block_on(foo_block())), 89);
}