summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/in-trait
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/in-trait
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 'tests/ui/async-await/in-trait')
-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
69 files changed, 226 insertions, 186 deletions
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
+