summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/ui/async-await
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/ui/async-await/async-await-let-else.stderr6
-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.rs7
-rw-r--r--tests/ui/async-await/async-trait-fn.stderr42
-rw-r--r--tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr2
-rw-r--r--tests/ui/async-await/async-unsafe-fn-call-in-safe.rs8
-rw-r--r--tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr18
-rw-r--r--tests/ui/async-await/coroutine-desc.rs (renamed from tests/ui/async-await/generator-desc.rs)0
-rw-r--r--tests/ui/async-await/coroutine-desc.stderr53
-rw-r--r--tests/ui/async-await/coroutine-not-future.rs45
-rw-r--r--tests/ui/async-await/coroutine-not-future.stderr81
-rw-r--r--tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.rs10
-rw-r--r--tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr23
-rw-r--r--tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr1
-rw-r--r--tests/ui/async-await/edition-deny-async-fns-2015.current.stderr98
-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.rs1
-rw-r--r--tests/ui/async-await/edition-deny-async-fns-2015.stderr24
-rw-r--r--tests/ui/async-await/feature-gate-async_fn_in_trait.rs25
-rw-r--r--tests/ui/async-await/feature-gate-async_fn_in_trait.stderr42
-rw-r--r--tests/ui/async-await/future-sizes/async-awaiting-fut.stdout6
-rw-r--r--tests/ui/async-await/generator-desc.stderr53
-rw-r--r--tests/ui/async-await/generator-not-future.rs45
-rw-r--r--tests/ui/async-await/generator-not-future.stderr81
-rw-r--r--tests/ui/async-await/in-trait/async-associated-types.rs5
-rw-r--r--tests/ui/async-await/in-trait/async-default-fn-overridden.rs3
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr6
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-extra.rs5
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-manual.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-manual.stderr2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared.rs5
-rw-r--r--tests/ui/async-await/in-trait/async-example.rs6
-rw-r--r--tests/ui/async-await/in-trait/async-generics-and-bounds.rs3
-rw-r--r--tests/ui/async-await/in-trait/async-generics-and-bounds.stderr38
-rw-r--r--tests/ui/async-await/in-trait/async-generics.rs3
-rw-r--r--tests/ui/async-await/in-trait/async-generics.stderr38
-rw-r--r--tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-lifetimes.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-recursive-generic.rs3
-rw-r--r--tests/ui/async-await/in-trait/async-recursive-generic.stderr4
-rw-r--r--tests/ui/async-await/in-trait/async-recursive.rs3
-rw-r--r--tests/ui/async-await/in-trait/async-recursive.stderr4
-rw-r--r--tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs2
-rw-r--r--tests/ui/async-await/in-trait/bad-signatures.rs1
-rw-r--r--tests/ui/async-await/in-trait/bad-signatures.stderr4
-rw-r--r--tests/ui/async-await/in-trait/coherence-constrained.rs26
-rw-r--r--tests/ui/async-await/in-trait/coherence-constrained.stderr25
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs1
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr12
-rw-r--r--tests/ui/async-await/in-trait/early-bound-1.rs4
-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-err.rs1
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err.stderr2
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err2.rs3
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err2.stderr12
-rw-r--r--tests/ui/async-await/in-trait/generics-mismatch.rs1
-rw-r--r--tests/ui/async-await/in-trait/generics-mismatch.stderr2
-rw-r--r--tests/ui/async-await/in-trait/implied-bounds.rs3
-rw-r--r--tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs2
-rw-r--r--tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr6
-rw-r--r--tests/ui/async-await/in-trait/issue-102138.rs3
-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.rs1
-rw-r--r--tests/ui/async-await/in-trait/lifetime-mismatch.stderr2
-rw-r--r--tests/ui/async-await/in-trait/missing-feature-flag.rs1
-rw-r--r--tests/ui/async-await/in-trait/missing-feature-flag.stderr16
-rw-r--r--tests/ui/async-await/in-trait/missing-send-bound.rs1
-rw-r--r--tests/ui/async-await/in-trait/missing-send-bound.stderr6
-rw-r--r--tests/ui/async-await/in-trait/nested-rpit.rs3
-rw-r--r--tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs2
-rw-r--r--tests/ui/async-await/in-trait/object-safety.rs1
-rw-r--r--tests/ui/async-await/in-trait/object-safety.stderr4
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-pair.rs1
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-pair.stderr8
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs1
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr2
-rw-r--r--tests/ui/async-await/in-trait/return-type-suggestion.rs1
-rw-r--r--tests/ui/async-await/in-trait/return-type-suggestion.stderr2
-rw-r--r--tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed1
-rw-r--r--tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs1
-rw-r--r--tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr8
-rw-r--r--tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs2
-rw-r--r--tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr6
-rw-r--r--tests/ui/async-await/in-trait/unconstrained-impl-region.rs19
-rw-r--r--tests/ui/async-await/in-trait/unconstrained-impl-region.stderr9
-rw-r--r--tests/ui/async-await/in-trait/warn.rs22
-rw-r--r--tests/ui/async-await/in-trait/warn.stderr20
-rw-r--r--tests/ui/async-await/issue-108572.fixed16
-rw-r--r--tests/ui/async-await/issue-108572.rs7
-rw-r--r--tests/ui/async-await/issue-108572.stderr9
-rw-r--r--tests/ui/async-await/issue-60709.rs2
-rw-r--r--tests/ui/async-await/issue-61793.rs2
-rw-r--r--tests/ui/async-await/issue-62658.rs2
-rw-r--r--tests/ui/async-await/issue-64130-3-other.stderr2
-rw-r--r--tests/ui/async-await/issue-66312.rs2
-rw-r--r--tests/ui/async-await/issue-66312.stderr11
-rw-r--r--tests/ui/async-await/issue-68112.stderr2
-rw-r--r--tests/ui/async-await/issue-70935-complex-spans.stderr2
-rw-r--r--tests/ui/async-await/issue-73137.rs2
-rw-r--r--tests/ui/async-await/issues/issue-51719.rs4
-rw-r--r--tests/ui/async-await/issues/issue-59972.rs2
-rw-r--r--tests/ui/async-await/issues/issue-60655-latebound-regions.rs2
-rw-r--r--tests/ui/async-await/issues/issue-64477-2.rs2
-rw-r--r--tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs4
-rw-r--r--tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs4
-rw-r--r--tests/ui/async-await/issues/issue-65419/issue-65419-coroutine-resume-after-completion.rs25
-rw-r--r--tests/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs25
-rw-r--r--tests/ui/async-await/issues/issue-67893.stderr6
-rw-r--r--tests/ui/async-await/issues/issue-95307.rs3
-rw-r--r--tests/ui/async-await/issues/issue-95307.stderr18
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr8
-rw-r--r--tests/ui/async-await/no-async-const.rs1
-rw-r--r--tests/ui/async-await/no-async-const.stderr11
-rw-r--r--tests/ui/async-await/no-unsafe-async.rs2
-rw-r--r--tests/ui/async-await/no-unsafe-async.stderr5
-rw-r--r--tests/ui/async-await/non-trivial-drop.rs2
-rw-r--r--tests/ui/async-await/partial-drop-partial-reinit.rs2
-rw-r--r--tests/ui/async-await/partial-drop-partial-reinit.stderr4
-rw-r--r--tests/ui/async-await/pin-needed-to-poll.stderr8
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.stderr4
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-early.rs1
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-early.stderr9
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-late.rs1
-rw-r--r--tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr8
-rw-r--r--tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr2
-rw-r--r--tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs1
-rw-r--r--tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr6
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr6
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound.current.stderr3
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound.next.stderr3
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound.stderr6
-rw-r--r--tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr2
-rw-r--r--tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr2
-rw-r--r--tests/ui/async-await/return-type-notation/supertrait-bound.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/supertrait-bound.stderr6
-rw-r--r--tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr3
-rw-r--r--tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr3
-rw-r--r--tests/ui/async-await/return-type-notation/ty-or-ct-params.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr6
-rw-r--r--tests/ui/async-await/send-bound-async-closure.rs2
-rw-r--r--tests/ui/async-await/task-context-arg.rs2
-rw-r--r--tests/ui/async-await/unnecessary-await.rs5
-rw-r--r--tests/ui/async-await/unnecessary-await.stderr15
153 files changed, 646 insertions, 922 deletions
diff --git a/tests/ui/async-await/async-await-let-else.stderr b/tests/ui/async-await/async-await-let-else.stderr
index 9a1c17822..b360aab6b 100644
--- a/tests/ui/async-await/async-await-let-else.stderr
+++ b/tests/ui/async-await/async-await-let-else.stderr
@@ -22,7 +22,7 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely
--> $DIR/async-await-let-else.rs:47:13
|
LL | async fn foo2(x: Option<bool>) {
- | - within this `impl Future<Output = ()>`
+ | ------------------------------ within this `impl Future<Output = ()>`
...
LL | is_send(foo2(Some(true)));
| ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely
@@ -30,7 +30,7 @@ LL | is_send(foo2(Some(true)));
| required by a bound introduced by this call
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/async-await-let-else.rs:24:29
|
LL | async fn bar2<T>(_: T) -> ! {
@@ -39,7 +39,7 @@ LL | | panic!()
LL | | }
| |_^
= note: required because it captures the following types: `impl Future<Output = !>`
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/async-await-let-else.rs:18:32
|
LL | async fn foo2(x: Option<bool>) {
diff --git a/tests/ui/async-await/async-trait-fn.current.stderr b/tests/ui/async-await/async-trait-fn.current.stderr
deleted file mode 100644
index 7ccf2f230..000000000
--- a/tests/ui/async-await/async-trait-fn.current.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-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
deleted file mode 100644
index 7ccf2f230..000000000
--- a/tests/ui/async-await/async-trait-fn.next.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-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 04123badb..4e5e3ba83 100644
--- a/tests/ui/async-await/async-trait-fn.rs
+++ b/tests/ui/async-await/async-trait-fn.rs
@@ -1,9 +1,10 @@
// edition:2018
+// check-pass
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`
- async fn baz() { //~ ERROR functions in traits cannot be declared `async`
+ async fn foo() {}
+ async fn bar(&self) {}
+ async fn baz() {
// Nested item must not ICE.
fn a() {}
}
diff --git a/tests/ui/async-await/async-trait-fn.stderr b/tests/ui/async-await/async-trait-fn.stderr
deleted file mode 100644
index 68ebe3507..000000000
--- a/tests/ui/async-await/async-trait-fn.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:4: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:5: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:6: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-unsafe-fn-call-in-safe.mir.stderr b/tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr
index 2114fb59b..f9e5bf675 100644
--- a/tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr
+++ b/tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr
@@ -23,7 +23,7 @@ LL | S::f();
= note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/async-unsafe-fn-call-in-safe.rs:24:5
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:26:5
|
LL | f();
| ^^^ call to unsafe function
diff --git a/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs b/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs
index c941dc27a..14cc0dc61 100644
--- a/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs
+++ b/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs
@@ -20,6 +20,10 @@ async fn g() {
}
fn main() {
- S::f(); //[mir]~ ERROR call to unsafe function is unsafe
- f(); //[mir]~ ERROR call to unsafe function is unsafe
+ S::f();
+ //[mir]~^ ERROR call to unsafe function is unsafe
+ //[thir]~^^ ERROR call to unsafe function `S::f` is unsafe
+ f();
+ //[mir]~^ ERROR call to unsafe function is unsafe
+ //[thir]~^^ ERROR call to unsafe function `f` is unsafe
}
diff --git a/tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr b/tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr
index 68d97d3fd..ba3303fe7 100644
--- a/tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr
+++ b/tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr
@@ -14,6 +14,22 @@ LL | f();
|
= note: consult the function's documentation for information on how to avoid undefined behavior
-error: aborting due to 2 previous errors
+error[E0133]: call to unsafe function `S::f` is unsafe and requires unsafe function or block
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:23:5
+ |
+LL | S::f();
+ | ^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:26:5
+ |
+LL | f();
+ | ^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/async-await/generator-desc.rs b/tests/ui/async-await/coroutine-desc.rs
index 500812016..500812016 100644
--- a/tests/ui/async-await/generator-desc.rs
+++ b/tests/ui/async-await/coroutine-desc.rs
diff --git a/tests/ui/async-await/coroutine-desc.stderr b/tests/ui/async-await/coroutine-desc.stderr
new file mode 100644
index 000000000..e4cb0915a
--- /dev/null
+++ b/tests/ui/async-await/coroutine-desc.stderr
@@ -0,0 +1,53 @@
+error[E0308]: mismatched types
+ --> $DIR/coroutine-desc.rs:10:19
+ |
+LL | fun(async {}, async {});
+ | --- -------- ^^^^^^^^ 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/coroutine-desc.rs:10:9: 10:17}`
+ found `async` block `{async block@$DIR/coroutine-desc.rs:10:19: 10:27}`
+note: function defined here
+ --> $DIR/coroutine-desc.rs:8:4
+ |
+LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/coroutine-desc.rs:12:16
+ |
+LL | fun(one(), two());
+ | --- ^^^^^ expected future, found a different future
+ | |
+ | arguments to this function are incorrect
+ |
+ = help: consider `await`ing on both `Future`s
+ = note: distinct uses of `impl Trait` result in different opaque types
+note: function defined here
+ --> $DIR/coroutine-desc.rs:8:4
+ |
+LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
+ | ^^^ -----
+
+error[E0308]: mismatched types
+ --> $DIR/coroutine-desc.rs:14:26
+ |
+LL | fun((async || {})(), (async || {})());
+ | --- -- ^^^^^^^^^^^^^^^ expected `async` closure body, found a different `async` closure body
+ | | |
+ | | the expected `async` closure body
+ | arguments to this function are incorrect
+ |
+ = note: expected `async` closure body `{async closure body@$DIR/coroutine-desc.rs:14:19: 14:21}`
+ found `async` closure body `{async closure body@$DIR/coroutine-desc.rs:14:36: 14:38}`
+note: function defined here
+ --> $DIR/coroutine-desc.rs:8:4
+ |
+LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
+ | ^^^ -----
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/async-await/coroutine-not-future.rs b/tests/ui/async-await/coroutine-not-future.rs
new file mode 100644
index 000000000..b18635fea
--- /dev/null
+++ b/tests/ui/async-await/coroutine-not-future.rs
@@ -0,0 +1,45 @@
+// edition:2018
+#![feature(coroutines, coroutine_trait)]
+
+use std::future::Future;
+use std::ops::Coroutine;
+
+async fn async_fn() {}
+fn returns_async_block() -> impl Future<Output = ()> {
+ async {}
+}
+fn returns_coroutine() -> impl Coroutine<(), Yield = (), Return = ()> {
+ || {
+ let _: () = yield ();
+ }
+}
+
+fn takes_future(_f: impl Future<Output = ()>) {}
+fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
+
+fn main() {
+ // okay:
+ takes_future(async_fn());
+ takes_future(returns_async_block());
+ takes_future(async {});
+ takes_coroutine(returns_coroutine());
+ takes_coroutine(|| {
+ let _: () = yield ();
+ });
+
+ // async futures are not coroutines:
+ takes_coroutine(async_fn());
+ //~^ ERROR the trait bound
+ takes_coroutine(returns_async_block());
+ //~^ ERROR the trait bound
+ takes_coroutine(async {});
+ //~^ ERROR the trait bound
+
+ // coroutines are not futures:
+ takes_future(returns_coroutine());
+ //~^ ERROR is not a future
+ takes_future(|ctx| {
+ //~^ ERROR is not a future
+ ctx = yield ();
+ });
+}
diff --git a/tests/ui/async-await/coroutine-not-future.stderr b/tests/ui/async-await/coroutine-not-future.stderr
new file mode 100644
index 000000000..130c5ef52
--- /dev/null
+++ b/tests/ui/async-await/coroutine-not-future.stderr
@@ -0,0 +1,81 @@
+error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied
+ --> $DIR/coroutine-not-future.rs:31:21
+ |
+LL | takes_coroutine(async_fn());
+ | --------------- ^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>`
+ | |
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `takes_coroutine`
+ --> $DIR/coroutine-not-future.rs:18:39
+ |
+LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
+
+error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied
+ --> $DIR/coroutine-not-future.rs:33:21
+ |
+LL | takes_coroutine(returns_async_block());
+ | --------------- ^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>`
+ | |
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `takes_coroutine`
+ --> $DIR/coroutine-not-future.rs:18:39
+ |
+LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
+
+error[E0277]: the trait bound `{async block@$DIR/coroutine-not-future.rs:35:21: 35:29}: Coroutine<_>` is not satisfied
+ --> $DIR/coroutine-not-future.rs:35:21
+ |
+LL | takes_coroutine(async {});
+ | --------------- ^^^^^^^^ the trait `Coroutine<_>` is not implemented for `{async block@$DIR/coroutine-not-future.rs:35:21: 35:29}`
+ | |
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `takes_coroutine`
+ --> $DIR/coroutine-not-future.rs:18:39
+ |
+LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
+
+error[E0277]: `impl Coroutine<Yield = (), Return = ()>` is not a future
+ --> $DIR/coroutine-not-future.rs:39:18
+ |
+LL | takes_future(returns_coroutine());
+ | ------------ ^^^^^^^^^^^^^^^^^^^ `impl Coroutine<Yield = (), Return = ()>` is not a future
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Future` is not implemented for `impl Coroutine<Yield = (), Return = ()>`
+ = note: impl Coroutine<Yield = (), Return = ()> must be a future or must implement `IntoFuture` to be awaited
+note: required by a bound in `takes_future`
+ --> $DIR/coroutine-not-future.rs:17:26
+ |
+LL | fn takes_future(_f: impl Future<Output = ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
+
+error[E0277]: `{coroutine@$DIR/coroutine-not-future.rs:41:18: 41:23}` is not a future
+ --> $DIR/coroutine-not-future.rs:41:18
+ |
+LL | takes_future(|ctx| {
+ | _____------------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | |
+LL | | ctx = yield ();
+LL | | });
+ | |_____^ `{coroutine@$DIR/coroutine-not-future.rs:41:18: 41:23}` is not a future
+ |
+ = help: the trait `Future` is not implemented for `{coroutine@$DIR/coroutine-not-future.rs:41:18: 41:23}`
+ = note: {coroutine@$DIR/coroutine-not-future.rs:41:18: 41:23} must be a future or must implement `IntoFuture` to be awaited
+note: required by a bound in `takes_future`
+ --> $DIR/coroutine-not-future.rs:17:26
+ |
+LL | fn takes_future(_f: impl Future<Output = ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.rs b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.rs
new file mode 100644
index 000000000..ced4434a7
--- /dev/null
+++ b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.rs
@@ -0,0 +1,10 @@
+// check-fail
+// edition:2021
+
+// test for issue-114912 - debug ice: attempted to add with overflow
+
+async fn main() {
+ //~^ ERROR `main` function is not allowed to be `async`
+ [0usize; 0xffff_ffff_ffff_ffff].await;
+ //~^ ERROR `[usize; usize::MAX]` is not a future
+}
diff --git a/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr
new file mode 100644
index 000000000..8c9d06c79
--- /dev/null
+++ b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr
@@ -0,0 +1,23 @@
+error[E0277]: `[usize; usize::MAX]` is not a future
+ --> $DIR/debug-ice-attempted-to-add-with-overflow.rs:8:37
+ |
+LL | [0usize; 0xffff_ffff_ffff_ffff].await;
+ | -^^^^^
+ | ||
+ | |`[usize; usize::MAX]` is not a future
+ | help: remove the `.await`
+ |
+ = help: the trait `Future` is not implemented for `[usize; usize::MAX]`
+ = note: [usize; usize::MAX] must be a future or must implement `IntoFuture` to be awaited
+ = note: required for `[usize; usize::MAX]` to implement `IntoFuture`
+
+error[E0752]: `main` function is not allowed to be `async`
+ --> $DIR/debug-ice-attempted-to-add-with-overflow.rs:6:1
+ |
+LL | async fn main() {
+ | ^^^^^^^^^^^^^^^ `main` function is not allowed to be `async`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0277, E0752.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr
index cfb0ebe38..0d3ee8a93 100644
--- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr
+++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr
@@ -23,6 +23,7 @@ LL | | });
|
= note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`...
= note: ...but it actually implements `FnOnce<(&(),)>`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.current.stderr b/tests/ui/async-await/edition-deny-async-fns-2015.current.stderr
deleted file mode 100644
index c47b99e65..000000000
--- a/tests/ui/async-await/edition-deny-async-fns-2015.current.stderr
+++ /dev/null
@@ -1,98 +0,0 @@
-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.next.stderr b/tests/ui/async-await/edition-deny-async-fns-2015.next.stderr
deleted file mode 100644
index c47b99e65..000000000
--- a/tests/ui/async-await/edition-deny-async-fns-2015.next.stderr
+++ /dev/null
@@ -1,98 +0,0 @@
-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..9059f99ba 100644
--- a/tests/ui/async-await/edition-deny-async-fns-2015.rs
+++ b/tests/ui/async-await/edition-deny-async-fns-2015.rs
@@ -16,7 +16,6 @@ impl Foo {
trait Bar {
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
- //~^ ERROR functions in traits cannot be declared `async`
}
fn main() {
diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.stderr b/tests/ui/async-await/edition-deny-async-fns-2015.stderr
index ba918eb28..c40cdc5ac 100644
--- a/tests/ui/async-await/edition-deny-async-fns-2015.stderr
+++ b/tests/ui/async-await/edition-deny-async-fns-2015.stderr
@@ -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:35: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:25: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:30:13
|
LL | async fn bar() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -79,20 +79,6 @@ LL | async fn bar() {}
= 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:18: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
+error: aborting due to 9 previous errors
-Some errors have detailed explanations: E0670, E0706.
-For more information about an error, try `rustc --explain E0670`.
+For more information about this error, try `rustc --explain E0670`.
diff --git a/tests/ui/async-await/feature-gate-async_fn_in_trait.rs b/tests/ui/async-await/feature-gate-async_fn_in_trait.rs
deleted file mode 100644
index 792f378cb..000000000
--- a/tests/ui/async-await/feature-gate-async_fn_in_trait.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-// edition:2021
-
-// RPITIT is not enough to allow use of async functions
-#![allow(incomplete_features)]
-#![feature(return_position_impl_trait_in_trait)]
-
-trait T {
- async fn foo(); //~ ERROR functions in traits cannot be declared `async`
-}
-
-// Both return_position_impl_trait_in_trait and async_fn_in_trait are required for this (see also
-// feature-gate-return_position_impl_trait_in_trait.rs)
-trait T2 {
- async fn foo() -> impl Sized; //~ ERROR functions in traits cannot be declared `async`
-}
-
-trait T3 {
- fn foo() -> impl std::future::Future<Output = ()>;
-}
-
-impl T3 for () {
- async fn foo() {} //~ ERROR functions in traits cannot be declared `async`
-}
-
-fn main() {}
diff --git a/tests/ui/async-await/feature-gate-async_fn_in_trait.stderr b/tests/ui/async-await/feature-gate-async_fn_in_trait.stderr
deleted file mode 100644
index 2a5fbd1ec..000000000
--- a/tests/ui/async-await/feature-gate-async_fn_in_trait.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/feature-gate-async_fn_in_trait.rs:8: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/feature-gate-async_fn_in_trait.rs:14:5
- |
-LL | async fn foo() -> impl Sized;
- | -----^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | `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/feature-gate-async_fn_in_trait.rs:22: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 3 previous errors
-
-For more information about this error, try `rustc --explain E0706`.
diff --git a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
index d63911b0d..b0447a582 100644
--- a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
+++ b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
@@ -19,18 +19,18 @@ print-type-size variant `Suspend0`: 2052 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
print-type-size padding: 1 bytes
print-type-size local `.fut`: 1025 bytes, alignment: 1 bytes
-print-type-size local `..generator_field4`: 1 bytes
+print-type-size local `..coroutine_field4`: 1 bytes
print-type-size local `.__awaitee`: 1 bytes
print-type-size variant `Suspend1`: 3076 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
print-type-size padding: 1026 bytes
-print-type-size local `..generator_field4`: 1 bytes, alignment: 1 bytes
+print-type-size local `..coroutine_field4`: 1 bytes, alignment: 1 bytes
print-type-size local `.__awaitee`: 1025 bytes
print-type-size variant `Suspend2`: 2052 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
print-type-size padding: 1 bytes
print-type-size local `.fut`: 1025 bytes, alignment: 1 bytes
-print-type-size local `..generator_field4`: 1 bytes
+print-type-size local `..coroutine_field4`: 1 bytes
print-type-size local `.__awaitee`: 1 bytes
print-type-size variant `Returned`: 1025 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
diff --git a/tests/ui/async-await/generator-desc.stderr b/tests/ui/async-await/generator-desc.stderr
deleted file mode 100644
index d3e951cfe..000000000
--- a/tests/ui/async-await/generator-desc.stderr
+++ /dev/null
@@ -1,53 +0,0 @@
-error[E0308]: mismatched types
- --> $DIR/generator-desc.rs:10:19
- |
-LL | fun(async {}, async {});
- | --- -------- ^^^^^^^^ 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
- --> $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
- |
-LL | fun(one(), two());
- | --- ^^^^^ expected future, found a different future
- | |
- | arguments to this function are incorrect
- |
- = help: consider `await`ing on both `Future`s
- = note: distinct uses of `impl Trait` result in different opaque types
-note: function defined here
- --> $DIR/generator-desc.rs:8:4
- |
-LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
- | ^^^ -----
-
-error[E0308]: mismatched types
- --> $DIR/generator-desc.rs:14:26
- |
-LL | fun((async || {})(), (async || {})());
- | --- -- ^^^^^^^^^^^^^^^ expected `async` closure body, found a different `async` closure body
- | | |
- | | the expected `async` closure body
- | arguments to this function are incorrect
- |
- = note: expected `async` closure body `{async closure body@$DIR/generator-desc.rs:14:19: 14:21}`
- found `async` closure body `{async closure body@$DIR/generator-desc.rs:14:36: 14:38}`
-note: function defined here
- --> $DIR/generator-desc.rs:8:4
- |
-LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
- | ^^^ -----
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/async-await/generator-not-future.rs b/tests/ui/async-await/generator-not-future.rs
deleted file mode 100644
index 37d7cfa6f..000000000
--- a/tests/ui/async-await/generator-not-future.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-// edition:2018
-#![feature(generators, generator_trait)]
-
-use std::future::Future;
-use std::ops::Generator;
-
-async fn async_fn() {}
-fn returns_async_block() -> impl Future<Output = ()> {
- async {}
-}
-fn returns_generator() -> impl Generator<(), Yield = (), Return = ()> {
- || {
- let _: () = yield ();
- }
-}
-
-fn takes_future(_f: impl Future<Output = ()>) {}
-fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {}
-
-fn main() {
- // okay:
- takes_future(async_fn());
- takes_future(returns_async_block());
- takes_future(async {});
- takes_generator(returns_generator());
- takes_generator(|| {
- let _: () = yield ();
- });
-
- // async futures are not generators:
- takes_generator(async_fn());
- //~^ ERROR the trait bound
- takes_generator(returns_async_block());
- //~^ ERROR the trait bound
- takes_generator(async {});
- //~^ ERROR the trait bound
-
- // generators are not futures:
- takes_future(returns_generator());
- //~^ ERROR is not a future
- takes_future(|ctx| {
- //~^ ERROR is not a future
- ctx = yield ();
- });
-}
diff --git a/tests/ui/async-await/generator-not-future.stderr b/tests/ui/async-await/generator-not-future.stderr
deleted file mode 100644
index 540501b98..000000000
--- a/tests/ui/async-await/generator-not-future.stderr
+++ /dev/null
@@ -1,81 +0,0 @@
-error[E0277]: the trait bound `impl Future<Output = ()>: Generator<_>` is not satisfied
- --> $DIR/generator-not-future.rs:31:21
- |
-LL | takes_generator(async_fn());
- | --------------- ^^^^^^^^^^ the trait `Generator<_>` is not implemented for `impl Future<Output = ()>`
- | |
- | required by a bound introduced by this call
- |
-note: required by a bound in `takes_generator`
- --> $DIR/generator-not-future.rs:18:39
- |
-LL | fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator`
-
-error[E0277]: the trait bound `impl Future<Output = ()>: Generator<_>` is not satisfied
- --> $DIR/generator-not-future.rs:33:21
- |
-LL | takes_generator(returns_async_block());
- | --------------- ^^^^^^^^^^^^^^^^^^^^^ the trait `Generator<_>` is not implemented for `impl Future<Output = ()>`
- | |
- | required by a bound introduced by this call
- |
-note: required by a bound in `takes_generator`
- --> $DIR/generator-not-future.rs:18:39
- |
-LL | fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator`
-
-error[E0277]: the trait bound `{async block@$DIR/generator-not-future.rs:35:21: 35:29}: Generator<_>` is not satisfied
- --> $DIR/generator-not-future.rs:35:21
- |
-LL | takes_generator(async {});
- | --------------- ^^^^^^^^ the trait `Generator<_>` is not implemented for `{async block@$DIR/generator-not-future.rs:35:21: 35:29}`
- | |
- | required by a bound introduced by this call
- |
-note: required by a bound in `takes_generator`
- --> $DIR/generator-not-future.rs:18:39
- |
-LL | fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator`
-
-error[E0277]: `impl Generator<Yield = (), Return = ()>` is not a future
- --> $DIR/generator-not-future.rs:39:18
- |
-LL | takes_future(returns_generator());
- | ------------ ^^^^^^^^^^^^^^^^^^^ `impl Generator<Yield = (), Return = ()>` is not a future
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Future` is not implemented for `impl Generator<Yield = (), Return = ()>`
- = note: impl Generator<Yield = (), Return = ()> must be a future or must implement `IntoFuture` to be awaited
-note: required by a bound in `takes_future`
- --> $DIR/generator-not-future.rs:17:26
- |
-LL | fn takes_future(_f: impl Future<Output = ()>) {}
- | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
-
-error[E0277]: `{generator@$DIR/generator-not-future.rs:41:18: 41:23}` is not a future
- --> $DIR/generator-not-future.rs:41:18
- |
-LL | takes_future(|ctx| {
- | _____------------_^
- | | |
- | | required by a bound introduced by this call
-LL | |
-LL | | ctx = yield ();
-LL | | });
- | |_____^ `{generator@$DIR/generator-not-future.rs:41:18: 41:23}` is not a future
- |
- = help: the trait `Future` is not implemented for `{generator@$DIR/generator-not-future.rs:41:18: 41:23}`
- = note: {generator@$DIR/generator-not-future.rs:41:18: 41:23} must be a future or must implement `IntoFuture` to be awaited
-note: required by a bound in `takes_future`
- --> $DIR/generator-not-future.rs:17:26
- |
-LL | fn takes_future(_f: impl Future<Output = ()>) {}
- | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
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 3e2739a16..8d8950047 100644
--- a/tests/ui/async-await/in-trait/async-associated-types.rs
+++ b/tests/ui/async-await/in-trait/async-associated-types.rs
@@ -1,20 +1,19 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Debug;
trait MyTrait<'a, 'b, T> where Self: 'a, T: Debug + Sized + 'b {
type MyAssoc;
+ #[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> Self::MyAssoc;
}
impl<'a, 'b, T: Debug + Sized + 'b, U: 'a> MyTrait<'a, 'b, T> for U {
type MyAssoc = (&'a U, &'b T);
+ #[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> (&'a U, &'b T) {
(self, key)
}
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 06413fe6f..c8fd2d8f6 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,15 +1,16 @@
// run-pass
// edition:2021
-#![feature(async_fn_in_trait)]
use std::future::Future;
trait AsyncTrait {
+ #[allow(async_fn_in_trait)]
async fn default_impl() {
assert!(false);
}
+ #[allow(async_fn_in_trait)]
async fn call_default_impl() {
Self::default_impl().await
}
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..c26f6625f 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,9 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::future::Future;
use std::pin::Pin;
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.stderr
index 168ef8e9e..b70b36adb 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.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:11:5
|
LL | async fn foo(&self) -> i32 {
- | ^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 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:7:22
|
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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..c5a984102 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,9 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::future::Future;
use std::pin::Pin;
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.stderr
index 60fa534a6..6392ce86e 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.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:11: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-extra.rs b/tests/ui/async-await/in-trait/async-example-desugared-extra.rs
index 3505690f1..ce93bd626 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,15 +1,14 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
-#![allow(incomplete_features)]
+#![feature(lint_reasons)]
use std::future::Future;
use std::pin::Pin;
use std::task::Poll;
pub trait MyTrait {
+ #[allow(async_fn_in_trait)]
async fn foo(&self) -> i32;
}
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..f7a351eff 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,10 +1,6 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::future::Future;
trait MyTrait {
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..c287b9a5b 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,9 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::future::Future;
use std::task::Poll;
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.stderr
index 567a36a86..1eda6fe65 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.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:19: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.rs b/tests/ui/async-await/in-trait/async-example-desugared.rs
index 0a5023176..78904d87a 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared.rs
@@ -1,13 +1,10 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::future::Future;
trait MyTrait {
+ #[allow(async_fn_in_trait)]
async fn foo(&self) -> i32;
}
diff --git a/tests/ui/async-await/in-trait/async-example.rs b/tests/ui/async-await/in-trait/async-example.rs
index abf94ef74..a32f979df 100644
--- a/tests/ui/async-await/in-trait/async-example.rs
+++ b/tests/ui/async-await/in-trait/async-example.rs
@@ -1,11 +1,11 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
trait MyTrait {
+ #[allow(async_fn_in_trait)]
async fn foo(&self) -> i32;
+
+ #[allow(async_fn_in_trait)]
async fn bar(&self) -> i32;
}
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..8dc0574c7 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
@@ -2,9 +2,6 @@
// known-bug: #102682
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Debug;
use std::hash::Hash;
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.stderr
index 5c8d64fc6..3cc35b214 100644
--- a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr
+++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr
@@ -1,36 +1,30 @@
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:9:5
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
+ | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | | |
+ | | the parameter type `U` must be valid for the anonymous lifetime as defined here...
+ | ...so that the reference type `&(T, U)` does not outlive the data it points at
|
-note: the parameter type `U` must be valid for the anonymous lifetime as defined here...
- --> $DIR/async-generics-and-bounds.rs:12:18
+help: consider adding an explicit lifetime bound
|
-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
- |
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
+LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: Debug + Sized, U: Hash, U: 'a;
+ | ++++ ++ ++ +++++++
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:9:5
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
+ | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | | |
+ | | the parameter type `T` must be valid for the anonymous lifetime as defined here...
+ | ...so that the reference type `&(T, U)` does not outlive the data it points at
|
-note: the parameter type `T` must be valid for the anonymous lifetime as defined here...
- --> $DIR/async-generics-and-bounds.rs:12:18
+help: consider adding an explicit lifetime bound
|
-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
- |
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
+LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: Debug + Sized, U: Hash, T: 'a;
+ | ++++ ++ ++ +++++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/in-trait/async-generics.rs b/tests/ui/async-await/in-trait/async-generics.rs
index 67000e577..6004916a4 100644
--- a/tests/ui/async-await/in-trait/async-generics.rs
+++ b/tests/ui/async-await/in-trait/async-generics.rs
@@ -2,9 +2,6 @@
// known-bug: #102682
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
trait MyTrait<T, U> {
async fn foo(&self) -> &(T, U);
}
diff --git a/tests/ui/async-await/in-trait/async-generics.stderr b/tests/ui/async-await/in-trait/async-generics.stderr
index 6ae73d9e3..3b27f8fe2 100644
--- a/tests/ui/async-await/in-trait/async-generics.stderr
+++ b/tests/ui/async-await/in-trait/async-generics.stderr
@@ -1,36 +1,30 @@
error[E0311]: the parameter type `U` may not live long enough
- --> $DIR/async-generics.rs:9:28
+ --> $DIR/async-generics.rs:6:5
|
LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
+ | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^
+ | | |
+ | | the parameter type `U` must be valid for the anonymous lifetime as defined here...
+ | ...so that the reference type `&(T, U)` does not outlive the data it points at
|
-note: the parameter type `U` must be valid for the anonymous lifetime as defined here...
- --> $DIR/async-generics.rs:9:18
+help: consider adding an explicit lifetime bound
|
-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
- |
-LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
+LL | async fn foo<'a>(&'a self) -> &'a (T, U) where U: 'a;
+ | ++++ ++ ++ +++++++++++
error[E0311]: the parameter type `T` may not live long enough
- --> $DIR/async-generics.rs:9:28
+ --> $DIR/async-generics.rs:6:5
|
LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
+ | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^
+ | | |
+ | | the parameter type `T` must be valid for the anonymous lifetime as defined here...
+ | ...so that the reference type `&(T, U)` does not outlive the data it points at
|
-note: the parameter type `T` must be valid for the anonymous lifetime as defined here...
- --> $DIR/async-generics.rs:9:18
+help: consider adding an explicit lifetime bound
|
-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
- |
-LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
+LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: 'a;
+ | ++++ ++ ++ +++++++++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs b/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs
index d5481d277..3721b0135 100644
--- a/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs
+++ b/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs
@@ -1,12 +1,10 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Debug;
trait MyTrait<'a, 'b, T> {
+ #[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T) where T: Debug + Sized;
}
diff --git a/tests/ui/async-await/in-trait/async-lifetimes.rs b/tests/ui/async-await/in-trait/async-lifetimes.rs
index f298e45d2..cb4b871cb 100644
--- a/tests/ui/async-await/in-trait/async-lifetimes.rs
+++ b/tests/ui/async-await/in-trait/async-lifetimes.rs
@@ -1,10 +1,8 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
trait MyTrait<'a, 'b, T> {
+ #[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T);
}
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..c6031ce28 100644
--- a/tests/ui/async-await/in-trait/async-recursive-generic.rs
+++ b/tests/ui/async-await/in-trait/async-recursive-generic.rs
@@ -1,8 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
trait MyTrait<T> {
async fn foo_recursive(&self, n: usize) -> T;
}
diff --git a/tests/ui/async-await/in-trait/async-recursive-generic.stderr b/tests/ui/async-await/in-trait/async-recursive-generic.stderr
index cab173bdd..cf0bcd741 100644
--- a/tests/ui/async-await/in-trait/async-recursive-generic.stderr
+++ b/tests/ui/async-await/in-trait/async-recursive-generic.stderr
@@ -1,8 +1,8 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/async-recursive-generic.rs:11:48
+ --> $DIR/async-recursive-generic.rs:8:5
|
LL | async fn foo_recursive(&self, n: usize) -> T {
- | ^ recursive `async fn`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
diff --git a/tests/ui/async-await/in-trait/async-recursive.rs b/tests/ui/async-await/in-trait/async-recursive.rs
index 61119f809..09f1ffe49 100644
--- a/tests/ui/async-await/in-trait/async-recursive.rs
+++ b/tests/ui/async-await/in-trait/async-recursive.rs
@@ -1,8 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
trait MyTrait {
async fn foo_recursive(&self, n: usize) -> i32;
}
diff --git a/tests/ui/async-await/in-trait/async-recursive.stderr b/tests/ui/async-await/in-trait/async-recursive.stderr
index 9feff37b3..b959652ea 100644
--- a/tests/ui/async-await/in-trait/async-recursive.stderr
+++ b/tests/ui/async-await/in-trait/async-recursive.stderr
@@ -1,8 +1,8 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/async-recursive.rs:11:48
+ --> $DIR/async-recursive.rs:8:5
|
LL | async fn foo_recursive(&self, n: usize) -> i32 {
- | ^^^ recursive `async fn`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
diff --git a/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs b/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs
index bba886f17..57c9b3ae8 100644
--- a/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs
+++ b/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs
@@ -1,7 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
-
pub trait Foo {
async fn test();
}
diff --git a/tests/ui/async-await/in-trait/bad-signatures.rs b/tests/ui/async-await/in-trait/bad-signatures.rs
index 98dddc126..5adede5b5 100644
--- a/tests/ui/async-await/in-trait/bad-signatures.rs
+++ b/tests/ui/async-await/in-trait/bad-signatures.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
trait MyTrait {
async fn bar(&abc self);
diff --git a/tests/ui/async-await/in-trait/bad-signatures.stderr b/tests/ui/async-await/in-trait/bad-signatures.stderr
index 7cbd96e24..127a343a9 100644
--- a/tests/ui/async-await/in-trait/bad-signatures.stderr
+++ b/tests/ui/async-await/in-trait/bad-signatures.stderr
@@ -1,11 +1,11 @@
error: expected identifier, found keyword `self`
- --> $DIR/bad-signatures.rs:6:23
+ --> $DIR/bad-signatures.rs:5:23
|
LL | async fn bar(&abc self);
| ^^^^ expected identifier, found keyword
error: expected one of `:`, `@`, or `|`, found keyword `self`
- --> $DIR/bad-signatures.rs:6:23
+ --> $DIR/bad-signatures.rs:5:23
|
LL | async fn bar(&abc self);
| -----^^^^
diff --git a/tests/ui/async-await/in-trait/coherence-constrained.rs b/tests/ui/async-await/in-trait/coherence-constrained.rs
new file mode 100644
index 000000000..8e62b3e0e
--- /dev/null
+++ b/tests/ui/async-await/in-trait/coherence-constrained.rs
@@ -0,0 +1,26 @@
+// edition: 2021
+
+trait Foo {
+ type T;
+
+ async fn foo(&self) -> Self::T;
+}
+
+struct Bar;
+
+impl Foo for Bar {
+ type T = ();
+
+ async fn foo(&self) {}
+ //~^ ERROR type annotations needed: cannot satisfy `<Bar as Foo>::T == ()`
+}
+
+impl Foo for Bar {
+ //~^ ERROR conflicting implementations of trait `Foo` for type `Bar`
+ type T = ();
+
+ async fn foo(&self) {}
+ //~^ ERROR type annotations needed: cannot satisfy `<Bar as Foo>::T == ()`
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/coherence-constrained.stderr b/tests/ui/async-await/in-trait/coherence-constrained.stderr
new file mode 100644
index 000000000..570a357ca
--- /dev/null
+++ b/tests/ui/async-await/in-trait/coherence-constrained.stderr
@@ -0,0 +1,25 @@
+error[E0284]: type annotations needed: cannot satisfy `<Bar as Foo>::T == ()`
+ --> $DIR/coherence-constrained.rs:14:5
+ |
+LL | async fn foo(&self) {}
+ | ^^^^^^^^^^^^^^^^^^^ cannot satisfy `<Bar as Foo>::T == ()`
+
+error[E0284]: type annotations needed: cannot satisfy `<Bar as Foo>::T == ()`
+ --> $DIR/coherence-constrained.rs:22:5
+ |
+LL | async fn foo(&self) {}
+ | ^^^^^^^^^^^^^^^^^^^ cannot satisfy `<Bar as Foo>::T == ()`
+
+error[E0119]: conflicting implementations of trait `Foo` for type `Bar`
+ --> $DIR/coherence-constrained.rs:18:1
+ |
+LL | impl Foo for Bar {
+ | ---------------- first implementation here
+...
+LL | impl Foo for Bar {
+ | ^^^^^^^^^^^^^^^^ conflicting implementation for `Bar`
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0119, E0284.
+For more information about an error, try `rustc --explain E0119`.
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..18b0fa485 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,7 +1,6 @@
// edition: 2021
// known-bug: #108309
-#![feature(async_fn_in_trait)]
#![feature(min_specialization)]
struct MyStruct;
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.stderr
index 7c750bf51..5e2be0862 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.stderr
@@ -1,24 +1,24 @@
error[E0053]: method `foo` has an incompatible type for trait
- --> $DIR/dont-project-to-specializable-projection.rs:14:35
+ --> $DIR/dont-project-to-specializable-projection.rs:13:5
|
LL | default async fn foo(_: T) -> &'static str {
- | ^^^^^^^^^^^^ expected associated type, found future
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found future
|
note: type in trait
- --> $DIR/dont-project-to-specializable-projection.rs:10:27
+ --> $DIR/dont-project-to-specializable-projection.rs:9:5
|
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:14:5
+ --> $DIR/dont-project-to-specializable-projection.rs:13: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
+ = note: specialization behaves in inconsistent and surprising ways with async functions in traits, and for now is disallowed
error: aborting due to 2 previous errors
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..ddcb477a1 100644
--- a/tests/ui/async-await/in-trait/early-bound-1.rs
+++ b/tests/ui/async-await/in-trait/early-bound-1.rs
@@ -1,10 +1,8 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
pub trait Foo {
+ #[allow(async_fn_in_trait)]
async fn foo(&mut self);
}
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..3eba5bf75 100644
--- a/tests/ui/async-await/in-trait/early-bound-2.rs
+++ b/tests/ui/async-await/in-trait/early-bound-2.rs
@@ -1,10 +1,10 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
pub trait Foo {
+ #[allow(async_fn_in_trait)]
async fn foo(&mut self);
}
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err.rs b/tests/ui/async-await/in-trait/fn-not-async-err.rs
index 9598d53bc..60077a7e0 100644
--- a/tests/ui/async-await/in-trait/fn-not-async-err.rs
+++ b/tests/ui/async-await/in-trait/fn-not-async-err.rs
@@ -1,6 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait MyTrait {
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err.stderr b/tests/ui/async-await/in-trait/fn-not-async-err.stderr
index 579801d0f..cd085074a 100644
--- a/tests/ui/async-await/in-trait/fn-not-async-err.stderr
+++ b/tests/ui/async-await/in-trait/fn-not-async-err.stderr
@@ -1,5 +1,5 @@
error: method `foo` should be async because the method from the trait is async
- --> $DIR/fn-not-async-err.rs:11:5
+ --> $DIR/fn-not-async-err.rs:10:5
|
LL | async fn foo(&self) -> i32;
| --------------------------- required because the trait method is async
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..ed626edc4 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,6 +1,6 @@
// edition: 2021
+// check-pass
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;
@@ -11,7 +11,6 @@ trait MyTrait {
impl MyTrait for i32 {
fn foo(&self) -> impl Future<Output = i32> {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
async { *self }
}
}
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.stderr
deleted file mode 100644
index 37d9669c0..000000000
--- a/tests/ui/async-await/in-trait/fn-not-async-err2.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-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
- |
-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/generics-mismatch.rs b/tests/ui/async-await/in-trait/generics-mismatch.rs
index fc29783c0..51fdc2fe8 100644
--- a/tests/ui/async-await/in-trait/generics-mismatch.rs
+++ b/tests/ui/async-await/in-trait/generics-mismatch.rs
@@ -1,6 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait Foo {
diff --git a/tests/ui/async-await/in-trait/generics-mismatch.stderr b/tests/ui/async-await/in-trait/generics-mismatch.stderr
index 3518aa05c..647cc698f 100644
--- a/tests/ui/async-await/in-trait/generics-mismatch.stderr
+++ b/tests/ui/async-await/in-trait/generics-mismatch.stderr
@@ -1,5 +1,5 @@
error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo`
- --> $DIR/generics-mismatch.rs:11:18
+ --> $DIR/generics-mismatch.rs:10:18
|
LL | trait Foo {
| ---
diff --git a/tests/ui/async-await/in-trait/implied-bounds.rs b/tests/ui/async-await/in-trait/implied-bounds.rs
index 52bceb3cc..0d8177c8e 100644
--- a/tests/ui/async-await/in-trait/implied-bounds.rs
+++ b/tests/ui/async-await/in-trait/implied-bounds.rs
@@ -1,12 +1,13 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait TcpStack {
type Connection<'a>: Sized where Self: 'a;
fn connect<'a>(&'a self) -> Self::Connection<'a>;
+
+ #[allow(async_fn_in_trait)]
async fn async_connect<'a>(&'a self) -> Self::Connection<'a>;
}
diff --git a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs
index 2fe6b473d..8443cbcf4 100644
--- a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs
+++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs
@@ -2,8 +2,6 @@
// build-fail
//~^^ ERROR cycle detected when computing layout of
-#![feature(async_fn_in_trait)]
-
fn main() {
let _ = async {
A.first().await.second().await;
diff --git a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr
index 41e84466a..ce02c1e99 100644
--- a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr
+++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr
@@ -1,8 +1,8 @@
-error[E0391]: cycle detected when computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:35:27: 37:6}`
+error[E0391]: cycle detected when computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:33:27: 35:6}`
|
= note: ...which requires computing layout of `<<A as First>::Second as Second>::{opaque#0}`...
- = note: ...which again requires computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:35:27: 37:6}`, completing the cycle
- = note: cycle used when computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:8:13: 10:6}`
+ = note: ...which again requires computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:33:27: 35:6}`, completing the cycle
+ = note: cycle used when computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:6:13: 8:6}`
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/async-await/in-trait/issue-102138.rs b/tests/ui/async-await/in-trait/issue-102138.rs
index f61b34ed9..221b830fc 100644
--- a/tests/ui/async-await/in-trait/issue-102138.rs
+++ b/tests/ui/async-await/in-trait/issue-102138.rs
@@ -1,7 +1,6 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;
@@ -10,6 +9,8 @@ async fn yield_now() {}
trait AsyncIterator {
type Item;
+
+ #[allow(async_fn_in_trait)]
async fn next(&mut self) -> Option<Self::Item>;
}
diff --git a/tests/ui/async-await/in-trait/issue-102219.rs b/tests/ui/async-await/in-trait/issue-102219.rs
index 9a35f6515..1f32cf691 100644
--- a/tests/ui/async-await/in-trait/issue-102219.rs
+++ b/tests/ui/async-await/in-trait/issue-102219.rs
@@ -2,9 +2,9 @@
// edition:2021
// check-pass
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait T {
+ #[allow(async_fn_in_trait)]
async fn foo();
}
diff --git a/tests/ui/async-await/in-trait/issue-102310.rs b/tests/ui/async-await/in-trait/issue-102310.rs
index 49c3e9fee..c6321dfcb 100644
--- a/tests/ui/async-await/in-trait/issue-102310.rs
+++ b/tests/ui/async-await/in-trait/issue-102310.rs
@@ -1,10 +1,10 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
pub trait SpiDevice {
+ #[allow(async_fn_in_trait)]
async fn transaction<F, R>(&mut self);
}
diff --git a/tests/ui/async-await/in-trait/issue-104678.rs b/tests/ui/async-await/in-trait/issue-104678.rs
index e396df4e5..db2fa3026 100644
--- a/tests/ui/async-await/in-trait/issue-104678.rs
+++ b/tests/ui/async-await/in-trait/issue-104678.rs
@@ -1,13 +1,13 @@
// edition:2021
// check-pass
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;
pub trait Pool {
type Conn;
+ #[allow(async_fn_in_trait)]
async fn async_callback<'a, F: FnOnce(&'a Self::Conn) -> Fut, Fut: Future<Output = ()>>(
&'a self,
callback: F,
diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.rs b/tests/ui/async-await/in-trait/lifetime-mismatch.rs
index bb793df5d..b45d1758d 100644
--- a/tests/ui/async-await/in-trait/lifetime-mismatch.rs
+++ b/tests/ui/async-await/in-trait/lifetime-mismatch.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
trait MyTrait {
async fn foo<'a>(&self);
diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.stderr b/tests/ui/async-await/in-trait/lifetime-mismatch.stderr
index 86592269c..3841ab934 100644
--- a/tests/ui/async-await/in-trait/lifetime-mismatch.stderr
+++ b/tests/ui/async-await/in-trait/lifetime-mismatch.stderr
@@ -1,5 +1,5 @@
error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
- --> $DIR/lifetime-mismatch.rs:11:17
+ --> $DIR/lifetime-mismatch.rs:10: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/missing-feature-flag.rs b/tests/ui/async-await/in-trait/missing-feature-flag.rs
index 34dd50a1c..898299a7d 100644
--- a/tests/ui/async-await/in-trait/missing-feature-flag.rs
+++ b/tests/ui/async-await/in-trait/missing-feature-flag.rs
@@ -1,6 +1,5 @@
// edition:2018
-#![feature(async_fn_in_trait)]
#![feature(min_specialization)]
struct MyStruct;
diff --git a/tests/ui/async-await/in-trait/missing-feature-flag.stderr b/tests/ui/async-await/in-trait/missing-feature-flag.stderr
index f6aba1fcd..b7a9e98fc 100644
--- a/tests/ui/async-await/in-trait/missing-feature-flag.stderr
+++ b/tests/ui/async-await/in-trait/missing-feature-flag.stderr
@@ -1,5 +1,5 @@
error[E0046]: not all trait items implemented, missing: `foo`
- --> $DIR/missing-feature-flag.rs:12:1
+ --> $DIR/missing-feature-flag.rs:11:1
|
LL | async fn foo(_: T) -> &'static str;
| ----------------------------------- `foo` from trait
@@ -7,8 +7,14 @@ LL | async fn foo(_: T) -> &'static str;
LL | impl<T> MyTrait<T> for MyStruct {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
+error[E0308]: mismatched types
+ --> $DIR/missing-feature-flag.rs:15:42
+ |
+LL | async fn foo(_: i32) -> &'static str {}
+ | ^^ expected `&str`, found `()`
+
error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default`
- --> $DIR/missing-feature-flag.rs:16:5
+ --> $DIR/missing-feature-flag.rs:15:5
|
LL | impl<T> MyTrait<T> for MyStruct {}
| ------------------------------- parent `impl` is here
@@ -18,12 +24,6 @@ LL | async fn foo(_: i32) -> &'static str {}
|
= note: to specialize, `foo` in the parent `impl` must be marked `default`
-error[E0308]: mismatched types
- --> $DIR/missing-feature-flag.rs:16:42
- |
-LL | async fn foo(_: i32) -> &'static str {}
- | ^^ expected `&str`, found `()`
-
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0046, E0308, E0520.
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 dbcc66576..596aece74 100644
--- a/tests/ui/async-await/in-trait/missing-send-bound.rs
+++ b/tests/ui/async-await/in-trait/missing-send-bound.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
trait Foo {
async fn bar();
diff --git a/tests/ui/async-await/in-trait/missing-send-bound.stderr b/tests/ui/async-await/in-trait/missing-send-bound.stderr
index 7e59d94d4..139bd06c7 100644
--- a/tests/ui/async-await/in-trait/missing-send-bound.stderr
+++ b/tests/ui/async-await/in-trait/missing-send-bound.stderr
@@ -1,17 +1,17 @@
error: future cannot be sent between threads safely
- --> $DIR/missing-send-bound.rs:14:20
+ --> $DIR/missing-send-bound.rs:13: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:10:5
+ --> $DIR/missing-send-bound.rs:9: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:18:27
+ --> $DIR/missing-send-bound.rs:17: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/nested-rpit.rs b/tests/ui/async-await/in-trait/nested-rpit.rs
index 9cdc23bbc..ccae08acc 100644
--- a/tests/ui/async-await/in-trait/nested-rpit.rs
+++ b/tests/ui/async-await/in-trait/nested-rpit.rs
@@ -1,14 +1,13 @@
// edition: 2021
// check-pass
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;
use std::marker::PhantomData;
trait Lockable<K, V> {
+ #[allow(async_fn_in_trait)]
async fn lock_all_entries(&self) -> impl Future<Output = Guard<'_>>;
}
diff --git a/tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs b/tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs
index c4008f2b7..9eb396f32 100644
--- a/tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs
+++ b/tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs
@@ -5,12 +5,12 @@
// We were not normalizing opaques with escaping bound vars during codegen,
// leading to later errors during debuginfo computation.
-#![feature(async_fn_in_trait)]
#[derive(Clone, Copy)]
pub struct SharedState {}
pub trait State {
+ #[allow(async_fn_in_trait)]
async fn execute(self, shared_state: &SharedState);
}
diff --git a/tests/ui/async-await/in-trait/object-safety.rs b/tests/ui/async-await/in-trait/object-safety.rs
index 441539e5d..5e5375b08 100644
--- a/tests/ui/async-await/in-trait/object-safety.rs
+++ b/tests/ui/async-await/in-trait/object-safety.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
trait Foo {
async fn foo(&self);
diff --git a/tests/ui/async-await/in-trait/object-safety.stderr b/tests/ui/async-await/in-trait/object-safety.stderr
index ccdf9d887..5b9fd98ac 100644
--- a/tests/ui/async-await/in-trait/object-safety.stderr
+++ b/tests/ui/async-await/in-trait/object-safety.stderr
@@ -1,11 +1,11 @@
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:10:12
+ --> $DIR/object-safety.rs:9: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:6:14
+ --> $DIR/object-safety.rs:5:14
|
LL | trait Foo {
| --- this trait cannot be made into an object...
diff --git a/tests/ui/async-await/in-trait/return-not-existing-pair.rs b/tests/ui/async-await/in-trait/return-not-existing-pair.rs
index a14dfceed..2286316dd 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-pair.rs
+++ b/tests/ui/async-await/in-trait/return-not-existing-pair.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
trait MyTrait<'a, 'b, T> {
async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
diff --git a/tests/ui/async-await/in-trait/return-not-existing-pair.stderr b/tests/ui/async-await/in-trait/return-not-existing-pair.stderr
index e573b8517..4694e6080 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-pair.stderr
+++ b/tests/ui/async-await/in-trait/return-not-existing-pair.stderr
@@ -1,5 +1,5 @@
error[E0726]: implicit elided lifetime not allowed here
- --> $DIR/return-not-existing-pair.rs:10:20
+ --> $DIR/return-not-existing-pair.rs:9:20
|
LL | impl<'a, 'b, T, U> MyTrait<T> for U {
| ^^^^^^^^^^ expected lifetime parameters
@@ -10,13 +10,13 @@ LL | impl<'a, 'b, T, U> MyTrait<'_, '_, T> for U {
| +++++++
error[E0412]: cannot find type `ConnImpl` in this scope
- --> $DIR/return-not-existing-pair.rs:6:48
+ --> $DIR/return-not-existing-pair.rs:5:48
|
LL | async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
| ^^^^^^^^ not found in this scope
error[E0186]: method `foo` has a `&self` declaration in the trait, but not in the impl
- --> $DIR/return-not-existing-pair.rs:12:5
+ --> $DIR/return-not-existing-pair.rs:11:5
|
LL | async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
| ------------------------------------------------------------ `&self` used in trait
@@ -25,7 +25,7 @@ LL | async fn foo(_: T) -> (&'a U, &'b T) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&self` in impl
error[E0308]: mismatched types
- --> $DIR/return-not-existing-pair.rs:12:42
+ --> $DIR/return-not-existing-pair.rs:11:42
|
LL | async fn foo(_: T) -> (&'a U, &'b T) {}
| ^^ expected `(&U, &T)`, found `()`
diff --git a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs
index 254b9a782..d23ef093b 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs
+++ b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(return_position_impl_trait_in_trait)]
struct Wrapper<T>(T);
diff --git a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr
index 059934d24..a66dd13bb 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr
+++ b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr
@@ -1,5 +1,5 @@
error[E0412]: cannot find type `Missing` in this scope
- --> $DIR/return-not-existing-type-wrapping-rpitit.rs:8:25
+ --> $DIR/return-not-existing-type-wrapping-rpitit.rs:7:25
|
LL | fn bar() -> Wrapper<Missing<impl Sized>>;
| ^^^^^^^ not found in this scope
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 cdab4ea0f..2b19b24cf 100644
--- a/tests/ui/async-await/in-trait/return-type-suggestion.rs
+++ b/tests/ui/async-await/in-trait/return-type-suggestion.rs
@@ -1,6 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
trait A {
async fn e() {
diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.stderr b/tests/ui/async-await/in-trait/return-type-suggestion.stderr
index 179c9ed93..363870619 100644
--- a/tests/ui/async-await/in-trait/return-type-suggestion.stderr
+++ b/tests/ui/async-await/in-trait/return-type-suggestion.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/return-type-suggestion.rs:7:9
+ --> $DIR/return-type-suggestion.rs:6:9
|
LL | Ok(())
| ^^^^^^ expected `()`, found `Result<(), _>`
diff --git a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed
index 33c005874..affe6cded 100644
--- a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed
+++ b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed
@@ -1,7 +1,6 @@
// run-rustfix
// edition: 2021
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(unused)]
trait Foo {
diff --git a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs
index 96b623d69..02bfee1a2 100644
--- a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs
+++ b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs
@@ -1,7 +1,6 @@
// run-rustfix
// edition: 2021
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(unused)]
trait Foo {
diff --git a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr
index 4319a1411..da51f10af 100644
--- a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr
+++ b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr
@@ -1,5 +1,5 @@
error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely
- --> $DIR/send-on-async-fn-in-trait.rs:14:16
+ --> $DIR/send-on-async-fn-in-trait.rs:13:16
|
LL | needs_send(T::test());
| ---------- ^^^^^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely
@@ -8,7 +8,7 @@ LL | needs_send(T::test());
|
= help: the trait `Send` is not implemented for `impl Future<Output = ()>`
note: required by a bound in `needs_send`
- --> $DIR/send-on-async-fn-in-trait.rs:13:27
+ --> $DIR/send-on-async-fn-in-trait.rs:12:27
|
LL | fn needs_send(_: impl Send) {}
| ^^^^ required by this bound in `needs_send`
@@ -19,7 +19,7 @@ LL + fn test() -> impl std::future::Future<Output = ()> + Send { async {} }
|
error[E0277]: `impl Future<Output = i32>` cannot be sent between threads safely
- --> $DIR/send-on-async-fn-in-trait.rs:16:16
+ --> $DIR/send-on-async-fn-in-trait.rs:15:16
|
LL | needs_send(T::test2());
| ---------- ^^^^^^^^^^ `impl Future<Output = i32>` cannot be sent between threads safely
@@ -28,7 +28,7 @@ LL | needs_send(T::test2());
|
= help: the trait `Send` is not implemented for `impl Future<Output = i32>`
note: required by a bound in `needs_send`
- --> $DIR/send-on-async-fn-in-trait.rs:13:27
+ --> $DIR/send-on-async-fn-in-trait.rs:12:27
|
LL | fn needs_send(_: impl Send) {}
| ^^^^ required by this bound in `needs_send`
diff --git a/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs
index 83b69d72a..f0d750714 100644
--- a/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs
+++ b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs
@@ -1,8 +1,6 @@
// aux-build:foreign-async-fn.rs
// edition:2021
-#![feature(async_fn_in_trait)]
-
extern crate foreign_async_fn;
use foreign_async_fn::Foo;
diff --git a/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr
index f337a04ba..482707351 100644
--- a/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr
+++ b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr
@@ -1,5 +1,5 @@
error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely
- --> $DIR/send-on-foreign-async-fn-in-trait.rs:11:16
+ --> $DIR/send-on-foreign-async-fn-in-trait.rs:9:16
|
LL | needs_send(T::test());
| ---------- ^^^^^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely
@@ -8,12 +8,12 @@ LL | needs_send(T::test());
|
= help: the trait `Send` is not implemented for `impl Future<Output = ()>`
note: `<T as Foo>::test` is an `async fn` in trait, which does not automatically imply that its future is `Send`
- --> $DIR/auxiliary/foreign-async-fn.rs:6:5
+ --> $DIR/auxiliary/foreign-async-fn.rs:4:5
|
LL | async fn test();
| ^^^^^^^^^^^^^^^^
note: required by a bound in `needs_send`
- --> $DIR/send-on-foreign-async-fn-in-trait.rs:10:27
+ --> $DIR/send-on-foreign-async-fn-in-trait.rs:8:27
|
LL | fn needs_send(_: impl Send) {}
| ^^^^ required by this bound in `needs_send`
diff --git a/tests/ui/async-await/in-trait/unconstrained-impl-region.rs b/tests/ui/async-await/in-trait/unconstrained-impl-region.rs
new file mode 100644
index 000000000..c06f9f005
--- /dev/null
+++ b/tests/ui/async-await/in-trait/unconstrained-impl-region.rs
@@ -0,0 +1,19 @@
+// edition: 2021
+
+pub(crate) trait Inbox<M> {
+ async fn next(self) -> M;
+}
+
+pub(crate) trait Actor: Sized {
+ type Message;
+
+ async fn on_mount(self, _: impl Inbox<Self::Message>);
+}
+
+impl<'a> Actor for () {
+//~^ ERROR the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
+ type Message = &'a ();
+ async fn on_mount(self, _: impl Inbox<&'a ()>) {}
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/unconstrained-impl-region.stderr b/tests/ui/async-await/in-trait/unconstrained-impl-region.stderr
new file mode 100644
index 000000000..2cb0da2e8
--- /dev/null
+++ b/tests/ui/async-await/in-trait/unconstrained-impl-region.stderr
@@ -0,0 +1,9 @@
+error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/unconstrained-impl-region.rs:13:6
+ |
+LL | impl<'a> Actor for () {
+ | ^^ unconstrained lifetime parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0207`.
diff --git a/tests/ui/async-await/in-trait/warn.rs b/tests/ui/async-await/in-trait/warn.rs
new file mode 100644
index 000000000..71f3822df
--- /dev/null
+++ b/tests/ui/async-await/in-trait/warn.rs
@@ -0,0 +1,22 @@
+// edition: 2021
+
+#![deny(async_fn_in_trait)]
+
+pub trait Foo {
+ async fn not_send();
+ //~^ ERROR use of `async fn` in public traits is discouraged
+}
+
+mod private {
+ pub trait FooUnreachable {
+ async fn not_send();
+ // No warning
+ }
+}
+
+pub(crate) trait FooCrate {
+ async fn not_send();
+ // No warning
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/warn.stderr b/tests/ui/async-await/in-trait/warn.stderr
new file mode 100644
index 000000000..d0278628c
--- /dev/null
+++ b/tests/ui/async-await/in-trait/warn.stderr
@@ -0,0 +1,20 @@
+error: use of `async fn` in public traits is discouraged as auto trait bounds cannot be specified
+ --> $DIR/warn.rs:6:5
+ |
+LL | async fn not_send();
+ | ^^^^^
+ |
+ = note: you can suppress this lint if you plan to use the trait only in your own code, or do not care about auto traits like `Send` on the `Future`
+note: the lint level is defined here
+ --> $DIR/warn.rs:3:9
+ |
+LL | #![deny(async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^
+help: you can alternatively desugar to a normal `fn` that returns `impl Future` and add any desired bounds such as `Send`, but these cannot be relaxed without a breaking API change
+ |
+LL - async fn not_send();
+LL + fn not_send() -> impl std::future::Future<Output = ()> + Send;
+ |
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-108572.fixed b/tests/ui/async-await/issue-108572.fixed
new file mode 100644
index 000000000..8f0133d97
--- /dev/null
+++ b/tests/ui/async-await/issue-108572.fixed
@@ -0,0 +1,16 @@
+// edition: 2021
+// run-rustfix
+#![allow(unused_must_use, dead_code)]
+
+use std::future::Future;
+fn foo() -> impl Future<Output=()> {
+ async { }
+}
+
+fn bar(cx: &mut std::task::Context<'_>) {
+ let fut = foo();
+ let mut pinned = std::pin::pin!(fut);
+ pinned.as_mut().poll(cx);
+ //~^ ERROR no method named `poll` found for opaque type `impl Future<Output = ()>` in the current scope [E0599]
+}
+fn main() {}
diff --git a/tests/ui/async-await/issue-108572.rs b/tests/ui/async-await/issue-108572.rs
index efcb8b8eb..359658076 100644
--- a/tests/ui/async-await/issue-108572.rs
+++ b/tests/ui/async-await/issue-108572.rs
@@ -1,12 +1,15 @@
// edition: 2021
+// run-rustfix
+#![allow(unused_must_use, dead_code)]
use std::future::Future;
fn foo() -> impl Future<Output=()> {
async { }
}
-fn main() {
+fn bar(cx: &mut std::task::Context<'_>) {
let fut = foo();
- fut.poll();
+ fut.poll(cx);
//~^ ERROR no method named `poll` found for opaque type `impl Future<Output = ()>` in the current scope [E0599]
}
+fn main() {}
diff --git a/tests/ui/async-await/issue-108572.stderr b/tests/ui/async-await/issue-108572.stderr
index 0dbcf4d66..588669092 100644
--- a/tests/ui/async-await/issue-108572.stderr
+++ b/tests/ui/async-await/issue-108572.stderr
@@ -1,11 +1,16 @@
error[E0599]: no method named `poll` found for opaque type `impl Future<Output = ()>` in the current scope
- --> $DIR/issue-108572.rs:10:9
+ --> $DIR/issue-108572.rs:12:9
|
-LL | fut.poll();
+LL | fut.poll(cx);
| ^^^^ 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
+help: consider pinning the expression
+ |
+LL ~ let mut pinned = std::pin::pin!(fut);
+LL ~ pinned.as_mut().poll(cx);
+ |
error: aborting due to previous error
diff --git a/tests/ui/async-await/issue-60709.rs b/tests/ui/async-await/issue-60709.rs
index 61f6ed1b7..2cda40e9e 100644
--- a/tests/ui/async-await/issue-60709.rs
+++ b/tests/ui/async-await/issue-60709.rs
@@ -1,5 +1,5 @@
// This used to compile the future down to ud2, due to uninhabited types being
-// handled incorrectly in generators.
+// handled incorrectly in coroutines.
// compile-flags: -Copt-level=z -Cdebuginfo=2 --edition=2018
// run-pass
diff --git a/tests/ui/async-await/issue-61793.rs b/tests/ui/async-await/issue-61793.rs
index 9180e1d81..bb861cf60 100644
--- a/tests/ui/async-await/issue-61793.rs
+++ b/tests/ui/async-await/issue-61793.rs
@@ -1,5 +1,5 @@
// This testcase used to ICE in codegen due to inconsistent field reordering
-// in the generator state, claiming a ZST field was after a non-ZST field,
+// in the coroutine state, claiming a ZST field was after a non-ZST field,
// while those two fields were at the same offset (which is impossible).
// That is, memory ordering of `(X, ())`, but offsets of `((), X)`.
diff --git a/tests/ui/async-await/issue-62658.rs b/tests/ui/async-await/issue-62658.rs
index d0af01e0c..8e6d070ea 100644
--- a/tests/ui/async-await/issue-62658.rs
+++ b/tests/ui/async-await/issue-62658.rs
@@ -1,4 +1,4 @@
-// This test created a generator whose size was not rounded to a multiple of its
+// This test created a coroutine whose size was not rounded to a multiple of its
// alignment. This caused an assertion error in codegen.
// build-pass
diff --git a/tests/ui/async-await/issue-64130-3-other.stderr b/tests/ui/async-await/issue-64130-3-other.stderr
index 573da1034..4bbb7731b 100644
--- a/tests/ui/async-await/issue-64130-3-other.stderr
+++ b/tests/ui/async-await/issue-64130-3-other.stderr
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output
--> $DIR/issue-64130-3-other.rs:25:12
|
LL | async fn bar() {
- | - within this `impl Future<Output = ()>`
+ | -------------- within this `impl Future<Output = ()>`
...
LL | is_qux(bar());
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
diff --git a/tests/ui/async-await/issue-66312.rs b/tests/ui/async-await/issue-66312.rs
index 9224971ec..fbc58697d 100644
--- a/tests/ui/async-await/issue-66312.rs
+++ b/tests/ui/async-await/issue-66312.rs
@@ -6,7 +6,7 @@ trait Test<T> {
async fn f() {
let x = Some(2);
- if x.is_some() {
+ if x.is_some() { //~ ERROR mismatched types
println!("Some");
}
}
diff --git a/tests/ui/async-await/issue-66312.stderr b/tests/ui/async-await/issue-66312.stderr
index 80d294a10..dad5807cb 100644
--- a/tests/ui/async-await/issue-66312.stderr
+++ b/tests/ui/async-await/issue-66312.stderr
@@ -7,6 +7,13 @@ LL | fn is_some(self: T);
= note: type of `self` must be `Self` or a type that dereferences to it
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
-error: aborting due to previous error
+error[E0308]: mismatched types
+ --> $DIR/issue-66312.rs:9:8
+ |
+LL | if x.is_some() {
+ | ^^^^^^^^^^^ expected `bool`, found `()`
+
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0307`.
+Some errors have detailed explanations: E0307, E0308.
+For more information about an error, try `rustc --explain E0307`.
diff --git a/tests/ui/async-await/issue-68112.stderr b/tests/ui/async-await/issue-68112.stderr
index 17b619ebe..1cd8beac2 100644
--- a/tests/ui/async-await/issue-68112.stderr
+++ b/tests/ui/async-await/issue-68112.stderr
@@ -45,7 +45,7 @@ LL | require_send(send_fut);
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
= note: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/issue-68112.rs:47:31
|
LL | async fn ready2<T>(t: T) -> T {
diff --git a/tests/ui/async-await/issue-70935-complex-spans.stderr b/tests/ui/async-await/issue-70935-complex-spans.stderr
index ab834daa8..d0605d7e1 100644
--- a/tests/ui/async-await/issue-70935-complex-spans.stderr
+++ b/tests/ui/async-await/issue-70935-complex-spans.stderr
@@ -18,7 +18,7 @@ note: required because it's used within this closure
|
LL | baz(|| async {
| ^^
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/issue-70935-complex-spans.rs:12:67
|
LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
diff --git a/tests/ui/async-await/issue-73137.rs b/tests/ui/async-await/issue-73137.rs
index c43ce2cad..2d16f1936 100644
--- a/tests/ui/async-await/issue-73137.rs
+++ b/tests/ui/async-await/issue-73137.rs
@@ -28,7 +28,7 @@ fn main() {
a: async { 0 }.await,
};
- // An error in the generator transform caused `b` to be overwritten with `a` when `b` was
+ // An error in the coroutine transform caused `b` to be overwritten with `a` when `b` was
// borrowed.
nop(&action.b);
assert_ne!(0usize, unsafe { std::mem::transmute(action.b) });
diff --git a/tests/ui/async-await/issues/issue-51719.rs b/tests/ui/async-await/issues/issue-51719.rs
index 09241f982..1cf388cd8 100644
--- a/tests/ui/async-await/issues/issue-51719.rs
+++ b/tests/ui/async-await/issues/issue-51719.rs
@@ -1,10 +1,10 @@
// edition:2018
//
-// Tests that the .await syntax can't be used to make a generator
+// Tests that the .await syntax can't be used to make a coroutine
async fn foo() {}
-fn make_generator() {
+fn make_coroutine() {
let _gen = || foo().await;
//~^ ERROR `await` is only allowed inside `async` functions and blocks
}
diff --git a/tests/ui/async-await/issues/issue-59972.rs b/tests/ui/async-await/issues/issue-59972.rs
index c2e24a96b..f60ec04c3 100644
--- a/tests/ui/async-await/issues/issue-59972.rs
+++ b/tests/ui/async-await/issues/issue-59972.rs
@@ -1,4 +1,4 @@
-// Incorrect handling of uninhabited types could cause us to mark generator
+// Incorrect handling of uninhabited types could cause us to mark coroutine
// types as entirely uninhabited, when they were in fact constructible. This
// caused us to hit "unreachable" code (illegal instruction on x86).
diff --git a/tests/ui/async-await/issues/issue-60655-latebound-regions.rs b/tests/ui/async-await/issues/issue-60655-latebound-regions.rs
index 66a3b07c3..ee28a2733 100644
--- a/tests/ui/async-await/issues/issue-60655-latebound-regions.rs
+++ b/tests/ui/async-await/issues/issue-60655-latebound-regions.rs
@@ -19,7 +19,7 @@ async fn async_nop(_: &u8) {}
pub type ServeFut = impl Future<Output=()>;
-// Late bound regions occur in the generator witness type here.
+// Late bound regions occur in the coroutine witness type here.
fn serve() -> ServeFut {
async move {
let x = 5;
diff --git a/tests/ui/async-await/issues/issue-64477-2.rs b/tests/ui/async-await/issues/issue-64477-2.rs
index 2360b57cc..53ec3b065 100644
--- a/tests/ui/async-await/issues/issue-64477-2.rs
+++ b/tests/ui/async-await/issues/issue-64477-2.rs
@@ -2,7 +2,7 @@
//
// In the past, the code generated by `format!` produced temporaries in the surrounding scope that
// borrowed the arguments through `&dyn Trait`. These temporaries do not implement `Send`, which
-// meant that when `format!` was used in an async block, the resulting generator was not `Send`.
+// meant that when `format!` was used in an async block, the resulting coroutine was not `Send`.
// See https://github.com/rust-lang/rust/issues/64477#issuecomment-534669068 for details
// and https://github.com/rust-lang/rust/issues/64477#issuecomment-531882958 for an example.
//
diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs
index 725caddae..9ed7a5d21 100644
--- a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs
+++ b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs
@@ -1,4 +1,4 @@
-// issue 65419 - Attempting to run an async fn after completion mentions generators when it should
+// issue 65419 - Attempting to run an async fn after completion mentions coroutines when it should
// be talking about `async fn`s instead.
// run-fail
@@ -8,7 +8,7 @@
// ignore-wasm no panic or subprocess support
// ignore-emscripten no panic or subprocess support
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
async fn foo() {
}
diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs
index 5909c3a5e..51e9a54e4 100644
--- a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs
+++ b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs
@@ -1,4 +1,4 @@
-// issue 65419 - Attempting to run an async fn after completion mentions generators when it should
+// issue 65419 - Attempting to run an async fn after completion mentions coroutines when it should
// be talking about `async fn`s instead. Should also test what happens when it panics.
// run-fail
@@ -8,7 +8,7 @@
// edition:2018
// ignore-wasm no panic or subprocess support
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::panic;
diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-coroutine-resume-after-completion.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-coroutine-resume-after-completion.rs
new file mode 100644
index 000000000..e16b86f95
--- /dev/null
+++ b/tests/ui/async-await/issues/issue-65419/issue-65419-coroutine-resume-after-completion.rs
@@ -0,0 +1,25 @@
+// issue 65419 - Attempting to run an `async fn` after completion mentions coroutines when it should
+// be talking about `async fn`s instead. Regression test added to make sure coroutines still
+// panic when resumed after completion.
+
+// run-fail
+// error-pattern:coroutine resumed after completion
+// edition:2018
+// ignore-wasm no panic or subprocess support
+// ignore-emscripten no panic or subprocess support
+
+#![feature(coroutines, coroutine_trait)]
+
+use std::{
+ ops::Coroutine,
+ pin::Pin,
+};
+
+fn main() {
+ let mut g = || {
+ yield;
+ };
+ Pin::new(&mut g).resume(()); // Yields once.
+ Pin::new(&mut g).resume(()); // Completes here.
+ Pin::new(&mut g).resume(()); // Panics here.
+}
diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs
deleted file mode 100644
index 9fc5667d6..000000000
--- a/tests/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-// issue 65419 - Attempting to run an `async fn` after completion mentions generators when it should
-// be talking about `async fn`s instead. Regression test added to make sure generators still
-// panic when resumed after completion.
-
-// run-fail
-// error-pattern:generator resumed after completion
-// edition:2018
-// ignore-wasm no panic or subprocess support
-// ignore-emscripten no panic or subprocess support
-
-#![feature(generators, generator_trait)]
-
-use std::{
- ops::Generator,
- pin::Pin,
-};
-
-fn main() {
- let mut g = || {
- yield;
- };
- Pin::new(&mut g).resume(()); // Yields once.
- Pin::new(&mut g).resume(()); // Completes here.
- Pin::new(&mut g).resume(()); // Panics here.
-}
diff --git a/tests/ui/async-await/issues/issue-67893.stderr b/tests/ui/async-await/issues/issue-67893.stderr
index f36269e8f..2a712aee9 100644
--- a/tests/ui/async-await/issues/issue-67893.stderr
+++ b/tests/ui/async-await/issues/issue-67893.stderr
@@ -6,14 +6,14 @@ LL | g(issue_67893::run())
| |
| required by a bound introduced by this call
|
- ::: $DIR/auxiliary/issue_67893.rs:9:20
+ ::: $DIR/auxiliary/issue_67893.rs:9:1
|
LL | pub async fn run() {
- | - within this `impl Future<Output = ()>`
+ | ------------------ within this `impl Future<Output = ()>`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
= note: required because it captures the following types: `Arc<Mutex<()>>`, `MutexGuard<'_, ()>`, `impl Future<Output = ()>`
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/auxiliary/issue_67893.rs:9:20
|
LL | pub async fn run() {
diff --git a/tests/ui/async-await/issues/issue-95307.rs b/tests/ui/async-await/issues/issue-95307.rs
index f7e48070c..35dce2c62 100644
--- a/tests/ui/async-await/issues/issue-95307.rs
+++ b/tests/ui/async-await/issues/issue-95307.rs
@@ -5,8 +5,7 @@
pub trait C {
async fn new() -> [u8; _];
- //~^ ERROR: functions in traits cannot be declared `async`
- //~| ERROR: using `_` for array lengths is unstable
+ //~^ ERROR: using `_` for array lengths is unstable
//~| ERROR: in expressions, `_` can only be used on the left-hand side of an assignment
}
diff --git a/tests/ui/async-await/issues/issue-95307.stderr b/tests/ui/async-await/issues/issue-95307.stderr
index a497cebe3..fdc6d5de1 100644
--- a/tests/ui/async-await/issues/issue-95307.stderr
+++ b/tests/ui/async-await/issues/issue-95307.stderr
@@ -1,16 +1,3 @@
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/issue-95307.rs:7:5
- |
-LL | async fn new() -> [u8; _];
- | -----^^^^^^^^^^^^^^^^^^^^^
- | |
- | `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: in expressions, `_` can only be used on the left-hand side of an assignment
--> $DIR/issue-95307.rs:7:28
|
@@ -26,7 +13,6 @@ LL | async fn new() -> [u8; _];
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0658, E0706.
-For more information about an error, try `rustc --explain E0658`.
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
index f789ad2a0..9442609e8 100644
--- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
+++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
@@ -1,17 +1,17 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:5:18
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:5:1
|
LL | async fn rec_1() {
- | ^ recursive `async fn`
+ | ^^^^^^^^^^^^^^^^ 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[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:1
|
LL | async fn rec_2() {
- | ^ recursive `async fn`
+ | ^^^^^^^^^^^^^^^^ 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
diff --git a/tests/ui/async-await/no-async-const.rs b/tests/ui/async-await/no-async-const.rs
index 963460c11..c9941d1c5 100644
--- a/tests/ui/async-await/no-async-const.rs
+++ b/tests/ui/async-await/no-async-const.rs
@@ -3,3 +3,4 @@
pub async const fn x() {}
//~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `const`
+//~| ERROR functions cannot be both `const` and `async`
diff --git a/tests/ui/async-await/no-async-const.stderr b/tests/ui/async-await/no-async-const.stderr
index a51dc88a4..524d778c0 100644
--- a/tests/ui/async-await/no-async-const.stderr
+++ b/tests/ui/async-await/no-async-const.stderr
@@ -9,5 +9,14 @@ LL | pub async const fn x() {}
|
= note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
-error: aborting due to previous error
+error: functions cannot be both `const` and `async`
+ --> $DIR/no-async-const.rs:4:5
+ |
+LL | pub async const fn x() {}
+ | ----^^^^^-^^^^^----------
+ | | |
+ | | `const` because of this
+ | `async` because of this
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/no-unsafe-async.rs b/tests/ui/async-await/no-unsafe-async.rs
index f40154e16..7c6811d81 100644
--- a/tests/ui/async-await/no-unsafe-async.rs
+++ b/tests/ui/async-await/no-unsafe-async.rs
@@ -9,3 +9,5 @@ impl S {
#[cfg(FALSE)]
unsafe async fn f() {} //~ ERROR expected one of `extern` or `fn`, found keyword `async`
+
+fn main() {}
diff --git a/tests/ui/async-await/no-unsafe-async.stderr b/tests/ui/async-await/no-unsafe-async.stderr
index f23d17d6b..49b112f93 100644
--- a/tests/ui/async-await/no-unsafe-async.stderr
+++ b/tests/ui/async-await/no-unsafe-async.stderr
@@ -1,16 +1,11 @@
error: expected one of `extern` or `fn`, found keyword `async`
--> $DIR/no-unsafe-async.rs:7:12
|
-LL | impl S {
- | - while parsing this item list starting here
-LL | #[cfg(FALSE)]
LL | unsafe async fn g() {}
| -------^^^^^
| | |
| | expected one of `extern` or `fn`
| help: `async` must come before `unsafe`: `async unsafe`
-LL | }
- | - the item list ends here
|
= note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
diff --git a/tests/ui/async-await/non-trivial-drop.rs b/tests/ui/async-await/non-trivial-drop.rs
index 3fed7c972..1004303d5 100644
--- a/tests/ui/async-await/non-trivial-drop.rs
+++ b/tests/ui/async-await/non-trivial-drop.rs
@@ -1,7 +1,7 @@
// build-pass
// edition:2018
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
foo();
diff --git a/tests/ui/async-await/partial-drop-partial-reinit.rs b/tests/ui/async-await/partial-drop-partial-reinit.rs
index 75acb442e..815cc916b 100644
--- a/tests/ui/async-await/partial-drop-partial-reinit.rs
+++ b/tests/ui/async-await/partial-drop-partial-reinit.rs
@@ -26,7 +26,7 @@ impl Drop for NotSend {
impl !Send for NotSend {}
async fn foo() {
- //~^ NOTE used within this `async fn` body
+ //~^ NOTE used within this `async` fn body
//~| NOTE within this `impl Future
let mut x = (NotSend {},);
drop(x.0);
diff --git a/tests/ui/async-await/partial-drop-partial-reinit.stderr b/tests/ui/async-await/partial-drop-partial-reinit.stderr
index 85e1830c7..310a29239 100644
--- a/tests/ui/async-await/partial-drop-partial-reinit.stderr
+++ b/tests/ui/async-await/partial-drop-partial-reinit.stderr
@@ -7,12 +7,12 @@ LL | gimme_send(foo());
| required by a bound introduced by this call
...
LL | async fn foo() {
- | - within this `impl Future<Output = ()>`
+ | -------------- within this `impl Future<Output = ()>`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend`
= note: required because it appears within the type `(NotSend,)`
= note: required because it captures the following types: `(NotSend,)`, `impl Future<Output = ()>`
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/partial-drop-partial-reinit.rs:28:16
|
LL | async fn foo() {
diff --git a/tests/ui/async-await/pin-needed-to-poll.stderr b/tests/ui/async-await/pin-needed-to-poll.stderr
index b1f4a73aa..964709dae 100644
--- a/tests/ui/async-await/pin-needed-to-poll.stderr
+++ b/tests/ui/async-await/pin-needed-to-poll.stderr
@@ -6,14 +6,12 @@ LL | struct Sleep;
...
LL | self.sleep.poll(cx)
| ^^^^ method not found in `Sleep`
- --> $SRC_DIR/core/src/future/future.rs:LL:COL
|
- = note: the method is available for `Pin<&mut Sleep>` here
+help: consider pinning the expression
|
-help: consider wrapping the receiver expression with the appropriate type
+LL ~ let mut pinned = std::pin::pin!(self.sleep);
+LL ~ pinned.as_mut().poll(cx)
|
-LL | Pin::new(&mut self.sleep).poll(cx)
- | +++++++++++++ +
error: aborting due to previous error
diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.stderr
index 63f64f445..64917329c 100644
--- a/tests/ui/async-await/recursive-async-impl-trait-type.stderr
+++ b/tests/ui/async-await/recursive-async-impl-trait-type.stderr
@@ -1,8 +1,8 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/recursive-async-impl-trait-type.rs:5:40
+ --> $DIR/recursive-async-impl-trait-type.rs:5:1
|
LL | async fn recursive_async_function() -> () {
- | ^^ recursive `async fn`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.rs b/tests/ui/async-await/return-type-notation/issue-110963-early.rs
index 0ecbca5c1..07f2130ba 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-early.rs
+++ b/tests/ui/async-await/return-type-notation/issue-110963-early.rs
@@ -2,7 +2,6 @@
// known-bug: #110963
#![feature(return_type_notation)]
-#![feature(async_fn_in_trait)]
trait HealthCheck {
async fn check<'a: 'a>(&'a mut self) -> bool;
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr
index 969094a2c..feae2698e 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr
+++ b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr
@@ -8,7 +8,7 @@ LL | #![feature(return_type_notation)]
= note: `#[warn(incomplete_features)]` on by default
error[E0308]: mismatched types
- --> $DIR/issue-110963-early.rs:15:5
+ --> $DIR/issue-110963-early.rs:14:5
|
LL | / spawn(async move {
LL | | let mut hc = hc;
@@ -21,13 +21,13 @@ LL | | });
= note: expected trait `Send`
found trait `for<'a> Send`
note: the lifetime requirement is introduced here
- --> $DIR/issue-110963-early.rs:35:17
+ --> $DIR/issue-110963-early.rs:34:17
|
LL | F: Future + Send + 'static,
| ^^^^
error[E0308]: mismatched types
- --> $DIR/issue-110963-early.rs:15:5
+ --> $DIR/issue-110963-early.rs:14:5
|
LL | / spawn(async move {
LL | | let mut hc = hc;
@@ -40,10 +40,11 @@ LL | | });
= note: expected trait `Send`
found trait `for<'a> Send`
note: the lifetime requirement is introduced here
- --> $DIR/issue-110963-early.rs:35:17
+ --> $DIR/issue-110963-early.rs:34:17
|
LL | F: Future + Send + 'static,
| ^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors; 1 warning emitted
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-late.rs b/tests/ui/async-await/return-type-notation/issue-110963-late.rs
index 17b5d775d..7533844fb 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-late.rs
+++ b/tests/ui/async-await/return-type-notation/issue-110963-late.rs
@@ -3,7 +3,6 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
-#![feature(async_fn_in_trait)]
trait HealthCheck {
async fn check(&mut self) -> bool;
diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr
index 8f4590203..6a47f1ab9 100644
--- a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr
+++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr
@@ -1,5 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/normalizing-self-auto-trait-issue-109924.rs:8:12
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:7:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #![feature(return_type_notation)]
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: `impl Future<Output = ()> { <_ as Foo>::bar() }` cannot be sent between threads safely
- --> $DIR/normalizing-self-auto-trait-issue-109924.rs:23:11
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:22:11
|
LL | build(Bar);
| ----- ^^^ `impl Future<Output = ()> { <_ as Foo>::bar() }` cannot be sent between threads safely
@@ -17,7 +17,7 @@ LL | build(Bar);
|
= help: the trait `for<'a> Send` is not implemented for `impl Future<Output = ()> { <_ as Foo>::bar() }`
note: this is a known limitation of the trait solver that will be lifted in the future
- --> $DIR/normalizing-self-auto-trait-issue-109924.rs:23:11
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:22:11
|
LL | build(Bar);
| ------^^^-
@@ -25,7 +25,7 @@ LL | build(Bar);
| | the trait solver is unable to infer the generic types that should be inferred from this argument
| add turbofish arguments to this call to specify the types manually, even if it's redundant
note: required by a bound in `build`
- --> $DIR/normalizing-self-auto-trait-issue-109924.rs:20:39
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:19:39
|
LL | fn build<T>(_: T) where T: Foo<bar(): Send> {}
| ^^^^ required by this bound in `build`
diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr
index 6fab71787..4837815fa 100644
--- a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr
+++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr
@@ -1,5 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/normalizing-self-auto-trait-issue-109924.rs:8:12
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:7:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs
index b2cd9707d..e581e5ffd 100644
--- a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs
+++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs
@@ -4,7 +4,6 @@
//[next] compile-flags: -Ztrait-solver=next
// edition:2021
-#![feature(async_fn_in_trait)]
#![feature(return_type_notation)]
//[next]~^ WARN the feature `return_type_notation` is incomplete
diff --git a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs
index e55104ee9..0ceb62d44 100644
--- a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs
+++ b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs
@@ -1,7 +1,7 @@
// edition:2021
// check-pass
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait, return_type_notation)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
use std::future::Future;
diff --git a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr
index 8626648b5..4a52e807b 100644
--- a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr
+++ b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr
@@ -1,8 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/rtn-implied-in-supertrait.rs:4:68
+ --> $DIR/rtn-implied-in-supertrait.rs:4:12
|
-LL | #![feature(async_fn_in_trait, return_position_impl_trait_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs
index 028e526b5..891b30638 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs
+++ b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs
@@ -1,6 +1,6 @@
// edition:2021
-#![feature(async_fn_in_trait, return_type_notation)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Super1<'a> {
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr
index 5bc8dbde4..d9caab587 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr
+++ b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr
@@ -1,8 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/super-method-bound-ambig.rs:3:31
+ --> $DIR/super-method-bound-ambig.rs:3:12
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.current.stderr b/tests/ui/async-await/return-type-notation/super-method-bound.current.stderr
index 891c802c5..5f482b608 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound.current.stderr
+++ b/tests/ui/async-await/return-type-notation/super-method-bound.current.stderr
@@ -1,8 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/super-method-bound.rs:6:31
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.next.stderr b/tests/ui/async-await/return-type-notation/super-method-bound.next.stderr
index 891c802c5..5f482b608 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound.next.stderr
+++ b/tests/ui/async-await/return-type-notation/super-method-bound.next.stderr
@@ -1,8 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/super-method-bound.rs:6:31
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.rs b/tests/ui/async-await/return-type-notation/super-method-bound.rs
index 58ea3578d..6025cda2f 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound.rs
+++ b/tests/ui/async-await/return-type-notation/super-method-bound.rs
@@ -1,7 +1,7 @@
// edition:2021
// check-pass
-#![feature(async_fn_in_trait, return_type_notation)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Super<'a> {
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.stderr b/tests/ui/async-await/return-type-notation/super-method-bound.stderr
index ac0668d3c..64fda71c1 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound.stderr
+++ b/tests/ui/async-await/return-type-notation/super-method-bound.stderr
@@ -1,8 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/super-method-bound.rs:4:31
+ --> $DIR/super-method-bound.rs:4:12
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr b/tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr
index 05cb0ca4a..928b32169 100644
--- a/tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr
+++ b/tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/supertrait-bound.rs:5:49
|
-LL | #![feature(return_position_impl_trait_in_trait, return_type_notation)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr b/tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr
index 05cb0ca4a..928b32169 100644
--- a/tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr
+++ b/tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/supertrait-bound.rs:5:49
|
-LL | #![feature(return_position_impl_trait_in_trait, return_type_notation)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.rs b/tests/ui/async-await/return-type-notation/supertrait-bound.rs
index 19bcfe304..a85596a9f 100644
--- a/tests/ui/async-await/return-type-notation/supertrait-bound.rs
+++ b/tests/ui/async-await/return-type-notation/supertrait-bound.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait, return_type_notation)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete and may not be safe to use
trait IntFactory {
diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.stderr b/tests/ui/async-await/return-type-notation/supertrait-bound.stderr
index c8cec4946..eb6917fc7 100644
--- a/tests/ui/async-await/return-type-notation/supertrait-bound.stderr
+++ b/tests/ui/async-await/return-type-notation/supertrait-bound.stderr
@@ -1,8 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/supertrait-bound.rs:3:49
+ --> $DIR/supertrait-bound.rs:3:12
|
-LL | #![feature(return_position_impl_trait_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr b/tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr
index 1aa008fe4..e2bbb6013 100644
--- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr
+++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr
@@ -1,8 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/ty-or-ct-params.rs:5:31
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr b/tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr
index 1aa008fe4..e2bbb6013 100644
--- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr
+++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr
@@ -1,8 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/ty-or-ct-params.rs:5:31
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs b/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs
index 7871a2fed..ac320cfc6 100644
--- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs
+++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs
@@ -1,6 +1,6 @@
// edition: 2021
-#![feature(async_fn_in_trait, return_type_notation)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Foo {
diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr b/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr
index 76928c5d7..da94d9d1e 100644
--- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr
+++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr
@@ -1,8 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/ty-or-ct-params.rs:3:31
+ --> $DIR/ty-or-ct-params.rs:3:12
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/send-bound-async-closure.rs b/tests/ui/async-await/send-bound-async-closure.rs
index 4e9e7309b..2ec006da3 100644
--- a/tests/ui/async-await/send-bound-async-closure.rs
+++ b/tests/ui/async-await/send-bound-async-closure.rs
@@ -2,7 +2,7 @@
// check-pass
// This test verifies that we do not create a query cycle when typechecking has several inference
-// variables that point to the same generator interior type.
+// variables that point to the same coroutine interior type.
use std::future::Future;
use std::pin::Pin;
diff --git a/tests/ui/async-await/task-context-arg.rs b/tests/ui/async-await/task-context-arg.rs
index 937723ca7..45b18d56b 100644
--- a/tests/ui/async-await/task-context-arg.rs
+++ b/tests/ui/async-await/task-context-arg.rs
@@ -10,7 +10,7 @@
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
+// argument _task_context. Later, when the MIR for that closure is transformed into a coroutine
// 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
diff --git a/tests/ui/async-await/unnecessary-await.rs b/tests/ui/async-await/unnecessary-await.rs
index cd1e28714..93b68f018 100644
--- a/tests/ui/async-await/unnecessary-await.rs
+++ b/tests/ui/async-await/unnecessary-await.rs
@@ -31,4 +31,9 @@ async fn with_macros() {
f!(());
}
+// Regression test for issue #117014.
+async fn desugaring_span_ctxt() {
+ for x in [] {}.await //~ ERROR `()` is not a future
+}
+
fn main() {}
diff --git a/tests/ui/async-await/unnecessary-await.stderr b/tests/ui/async-await/unnecessary-await.stderr
index 9a2a035b2..620370a61 100644
--- a/tests/ui/async-await/unnecessary-await.stderr
+++ b/tests/ui/async-await/unnecessary-await.stderr
@@ -49,6 +49,19 @@ LL | f!(());
= note: required for `()` to implement `IntoFuture`
= note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: aborting due to 3 previous errors
+error[E0277]: `()` is not a future
+ --> $DIR/unnecessary-await.rs:36:20
+ |
+LL | for x in [] {}.await
+ | -^^^^^
+ | ||
+ | |`()` is not a future
+ | help: remove the `.await`
+ |
+ = help: the trait `Future` is not implemented for `()`
+ = note: () must be a future or must implement `IntoFuture` to be awaited
+ = note: required for `()` to implement `IntoFuture`
+
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0277`.