Stabilize AFIT and RPITIT

This commit is contained in:
Michael Goulet 2023-09-13 16:04:42 +00:00
parent 57ef889852
commit 59315b8a63
229 changed files with 284 additions and 1032 deletions

View File

@ -271,8 +271,6 @@ enum ImplTraitPosition {
ClosureReturn,
PointerReturn,
FnTraitReturn,
TraitReturn,
ImplReturn,
GenericDefault,
ConstTy,
StaticTy,
@ -302,8 +300,6 @@ impl std::fmt::Display for ImplTraitPosition {
ImplTraitPosition::ClosureReturn => "closure return types",
ImplTraitPosition::PointerReturn => "`fn` pointer return types",
ImplTraitPosition::FnTraitReturn => "`Fn` trait return types",
ImplTraitPosition::TraitReturn => "trait method return types",
ImplTraitPosition::ImplReturn => "`impl` method return types",
ImplTraitPosition::GenericDefault => "generic parameter defaults",
ImplTraitPosition::ConstTy => "const types",
ImplTraitPosition::StaticTy => "static types",
@ -334,20 +330,16 @@ impl FnDeclKind {
matches!(self, FnDeclKind::Fn | FnDeclKind::Inherent | FnDeclKind::Impl | FnDeclKind::Trait)
}
fn return_impl_trait_allowed(&self, tcx: TyCtxt<'_>) -> bool {
fn return_impl_trait_allowed(&self) -> bool {
match self {
FnDeclKind::Fn | FnDeclKind::Inherent => true,
FnDeclKind::Impl if tcx.features().return_position_impl_trait_in_trait => true,
FnDeclKind::Trait if tcx.features().return_position_impl_trait_in_trait => true,
FnDeclKind::Fn | FnDeclKind::Inherent | FnDeclKind::Impl | FnDeclKind::Trait => true,
_ => false,
}
}
fn async_fn_allowed(&self, tcx: TyCtxt<'_>) -> bool {
fn async_fn_allowed(&self) -> bool {
match self {
FnDeclKind::Fn | FnDeclKind::Inherent => true,
FnDeclKind::Impl if tcx.features().async_fn_in_trait => true,
FnDeclKind::Trait if tcx.features().async_fn_in_trait => true,
FnDeclKind::Fn | FnDeclKind::Inherent | FnDeclKind::Impl | FnDeclKind::Trait => true,
_ => false,
}
}
@ -1806,21 +1798,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
}));
let output = if let Some((ret_id, span)) = make_ret_async {
if !kind.async_fn_allowed(self.tcx) {
match kind {
FnDeclKind::Trait | FnDeclKind::Impl => {
self.tcx
.sess
.create_feature_err(
TraitFnAsync { fn_span, span },
sym::async_fn_in_trait,
)
.emit();
}
_ => {
self.tcx.sess.emit_err(TraitFnAsync { fn_span, span });
}
}
if !kind.async_fn_allowed() {
self.tcx.sess.emit_err(TraitFnAsync { fn_span, span });
}
let fn_def_id = self.local_def_id(fn_node_id);
@ -1828,30 +1807,24 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
} else {
match &decl.output {
FnRetTy::Ty(ty) => {
let context = if kind.return_impl_trait_allowed(self.tcx) {
let context = if kind.return_impl_trait_allowed() {
let fn_def_id = self.local_def_id(fn_node_id);
ImplTraitContext::ReturnPositionOpaqueTy {
origin: hir::OpaqueTyOrigin::FnReturn(fn_def_id),
fn_kind: kind,
}
} else {
let position = match kind {
FnDeclKind::Fn | FnDeclKind::Inherent => {
unreachable!("fn should allow in-band lifetimes")
ImplTraitContext::Disallowed(match kind {
FnDeclKind::Fn
| FnDeclKind::Inherent
| FnDeclKind::Trait
| FnDeclKind::Impl => {
unreachable!("fn should allow return-position impl trait in traits")
}
FnDeclKind::ExternFn => ImplTraitPosition::ExternFnReturn,
FnDeclKind::Closure => ImplTraitPosition::ClosureReturn,
FnDeclKind::Pointer => ImplTraitPosition::PointerReturn,
FnDeclKind::Trait => ImplTraitPosition::TraitReturn,
FnDeclKind::Impl => ImplTraitPosition::ImplReturn,
};
match kind {
FnDeclKind::Trait | FnDeclKind::Impl => ImplTraitContext::FeatureGated(
position,
sym::return_position_impl_trait_in_trait,
),
_ => ImplTraitContext::Disallowed(position),
}
})
};
hir::FnRetTy::Return(self.lower_ty(ty, &context))
}
@ -1924,18 +1897,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
let future_bound = this.lower_async_fn_output_type_to_future_bound(
output,
span,
if let FnDeclKind::Trait = fn_kind
&& !this.tcx.features().return_position_impl_trait_in_trait
{
ImplTraitContext::FeatureGated(
ImplTraitPosition::TraitReturn,
sym::return_position_impl_trait_in_trait,
)
} else {
ImplTraitContext::ReturnPositionOpaqueTy {
origin: hir::OpaqueTyOrigin::FnReturn(fn_def_id),
fn_kind,
}
ImplTraitContext::ReturnPositionOpaqueTy {
origin: hir::OpaqueTyOrigin::FnReturn(fn_def_id),
fn_kind,
},
);
arena_vec![this; future_bound]

View File

@ -67,6 +67,8 @@ declare_features! (
(accepted, associated_types, "1.0.0", None, None),
/// Allows free and inherent `async fn`s, `async` blocks, and `<expr>.await` expressions.
(accepted, async_await, "1.39.0", Some(50547), None),
/// Allows async functions to be declared, implemented, and used in traits.
(accepted, async_fn_in_trait, "CURRENT_RUSTC_VERSION", Some(91611), None),
/// Allows all literals in attribute lists and values of key-value pairs.
(accepted, attr_literals, "1.30.0", Some(34981), None),
/// Allows overloading augmented assignment operations like `a += b`.
@ -306,6 +308,8 @@ declare_features! (
(accepted, repr_packed, "1.33.0", Some(33158), None),
/// Allows `#[repr(transparent)]` attribute on newtype structs.
(accepted, repr_transparent, "1.28.0", Some(43036), None),
/// Allows return-position `impl Trait` in traits.
(accepted, return_position_impl_trait_in_trait, "CURRENT_RUSTC_VERSION", Some(91611), None),
/// Allows code like `let x: &'static u32 = &42` to work (RFC 1414).
(accepted, rvalue_static_promotion, "1.21.0", Some(38865), None),
/// Allows `Self` in type definitions (RFC 2300).

View File

@ -351,8 +351,6 @@ declare_features! (
(active, associated_type_defaults, "1.2.0", Some(29661), None),
/// Allows `async || body` closures.
(active, async_closure, "1.37.0", Some(62290), None),
/// Allows async functions to be declared, implemented, and used in traits.
(active, async_fn_in_trait, "1.66.0", Some(91611), None),
/// Allows `#[track_caller]` on async functions.
(active, async_fn_track_caller, "1.73.0", Some(110011), None),
/// Allows builtin # foo() syntax
@ -551,8 +549,6 @@ declare_features! (
(incomplete, repr128, "1.16.0", Some(56071), None),
/// Allows `repr(simd)` and importing the various simd intrinsics.
(active, repr_simd, "1.4.0", Some(27731), None),
/// Allows return-position `impl Trait` in traits.
(active, return_position_impl_trait_in_trait, "1.65.0", Some(91611), None),
/// Allows bounding the return type of AFIT/RPITIT.
(incomplete, return_type_notation, "1.70.0", Some(109417), None),
/// Allows `extern "rust-cold"`.

View File

@ -783,21 +783,21 @@ fn check_impl_items_against_trait<'tcx>(
let (msg, feature) = if tcx.asyncness(def_id).is_async() {
(
format!("async {descr} in trait cannot be specialized"),
sym::async_fn_in_trait,
"async functions in traits",
)
} else {
(
format!(
"{descr} with return-position `impl Trait` in trait cannot be specialized"
),
sym::return_position_impl_trait_in_trait,
"return position `impl Trait` in traits",
)
};
tcx.sess
.struct_span_err(tcx.def_span(def_id), msg)
.note(format!(
"specialization behaves in inconsistent and \
surprising ways with `#![feature({feature})]`, \
surprising ways with {feature}, \
and for now is disallowed"
))
.emit();

View File

@ -633,8 +633,6 @@ fn compare_asyncness<'tcx>(
/// For example, given the sample code:
///
/// ```
/// #![feature(return_position_impl_trait_in_trait)]
///
/// use std::ops::Deref;
///
/// trait Foo {

View File

@ -11,7 +11,6 @@ declare_lint! {
/// ### Example
///
/// ```rust
/// # #![feature(async_fn_in_trait)]
/// pub trait Trait {
/// async fn method(&self);
/// }
@ -33,7 +32,6 @@ declare_lint! {
/// For example, this code is invalid:
///
/// ```rust,compile_fail
/// # #![feature(async_fn_in_trait)]
/// pub trait Trait {
/// async fn method(&self) {}
/// }
@ -51,7 +49,6 @@ declare_lint! {
/// For example, instead of:
///
/// ```rust
/// # #![feature(async_fn_in_trait)]
/// pub trait Trait {
/// async fn method(&self) {}
/// }

View File

@ -4574,7 +4574,6 @@ declare_lint! {
/// ### Example
///
/// ```rust,compile_fail
/// #![feature(return_position_impl_trait_in_trait)]
/// #![deny(refining_impl_trait)]
///
/// use std::fmt::Display;

View File

@ -1,6 +1,5 @@
#![warn(clippy::implied_bounds_in_impls)]
#![allow(dead_code)]
#![feature(return_position_impl_trait_in_trait)]
use std::ops::{Deref, DerefMut};

View File

@ -1,6 +1,5 @@
#![warn(clippy::implied_bounds_in_impls)]
#![allow(dead_code)]
#![feature(return_position_impl_trait_in_trait)]
use std::ops::{Deref, DerefMut};

View File

@ -1,5 +1,5 @@
error: this bound is already specified as the supertrait of `DerefMut<Target = T>`
--> $DIR/implied_bounds_in_impls.rs:13:36
--> $DIR/implied_bounds_in_impls.rs:12:36
|
LL | fn deref_derefmut<T>(x: T) -> impl Deref<Target = T> + DerefMut<Target = T> {
| ^^^^^^^^^^^^^^^^^
@ -13,7 +13,7 @@ LL + fn deref_derefmut<T>(x: T) -> impl DerefMut<Target = T> {
|
error: this bound is already specified as the supertrait of `GenericSubtrait<U, W, U>`
--> $DIR/implied_bounds_in_impls.rs:30:37
--> $DIR/implied_bounds_in_impls.rs:29:37
|
LL | fn generics_implied<U, W>() -> impl GenericTrait<W> + GenericSubtrait<U, W, U>
| ^^^^^^^^^^^^^^^
@ -25,7 +25,7 @@ LL + fn generics_implied<U, W>() -> impl GenericSubtrait<U, W, U>
|
error: this bound is already specified as the supertrait of `GenericSubtrait<(), i32, V>`
--> $DIR/implied_bounds_in_impls.rs:36:40
--> $DIR/implied_bounds_in_impls.rs:35:40
|
LL | fn generics_implied_multi<V>() -> impl GenericTrait<i32> + GenericTrait2<V> + GenericSubtrait<(), i32, V> {}
| ^^^^^^^^^^^^^^^^^
@ -37,7 +37,7 @@ LL + fn generics_implied_multi<V>() -> impl GenericTrait2<V> + GenericSubtrait<(
|
error: this bound is already specified as the supertrait of `GenericSubtrait<(), i32, V>`
--> $DIR/implied_bounds_in_impls.rs:36:60
--> $DIR/implied_bounds_in_impls.rs:35:60
|
LL | fn generics_implied_multi<V>() -> impl GenericTrait<i32> + GenericTrait2<V> + GenericSubtrait<(), i32, V> {}
| ^^^^^^^^^^^^^^^^
@ -49,7 +49,7 @@ LL + fn generics_implied_multi<V>() -> impl GenericTrait<i32> + GenericSubtrait<
|
error: this bound is already specified as the supertrait of `GenericSubtrait<(), T, V>`
--> $DIR/implied_bounds_in_impls.rs:38:44
--> $DIR/implied_bounds_in_impls.rs:37:44
|
LL | fn generics_implied_multi2<T, V>() -> impl GenericTrait<T> + GenericTrait2<V> + GenericSubtrait<(), T, V>
| ^^^^^^^^^^^^^^^
@ -61,7 +61,7 @@ LL + fn generics_implied_multi2<T, V>() -> impl GenericTrait2<V> + GenericSubtra
|
error: this bound is already specified as the supertrait of `GenericSubtrait<(), T, V>`
--> $DIR/implied_bounds_in_impls.rs:38:62
--> $DIR/implied_bounds_in_impls.rs:37:62
|
LL | fn generics_implied_multi2<T, V>() -> impl GenericTrait<T> + GenericTrait2<V> + GenericSubtrait<(), T, V>
| ^^^^^^^^^^^^^^^^
@ -73,7 +73,7 @@ LL + fn generics_implied_multi2<T, V>() -> impl GenericTrait<T> + GenericSubtrai
|
error: this bound is already specified as the supertrait of `GenericSubtrait<(), i32, ()>`
--> $DIR/implied_bounds_in_impls.rs:48:28
--> $DIR/implied_bounds_in_impls.rs:47:28
|
LL | fn generics_same() -> impl GenericTrait<i32> + GenericSubtrait<(), i32, ()> {}
| ^^^^^^^^^^^^^^^^^
@ -85,7 +85,7 @@ LL + fn generics_same() -> impl GenericSubtrait<(), i32, ()> {}
|
error: this bound is already specified as the supertrait of `DerefMut<Target = u8>`
--> $DIR/implied_bounds_in_impls.rs:52:20
--> $DIR/implied_bounds_in_impls.rs:51:20
|
LL | fn f() -> impl Deref + DerefMut<Target = u8>;
| ^^^^^
@ -97,7 +97,7 @@ LL + fn f() -> impl DerefMut<Target = u8>;
|
error: this bound is already specified as the supertrait of `DerefMut<Target = u8>`
--> $DIR/implied_bounds_in_impls.rs:57:20
--> $DIR/implied_bounds_in_impls.rs:56:20
|
LL | fn f() -> impl Deref + DerefMut<Target = u8> {
| ^^^^^
@ -109,7 +109,7 @@ LL + fn f() -> impl DerefMut<Target = u8> {
|
error: this bound is already specified as the supertrait of `DerefMut<Target = u8>`
--> $DIR/implied_bounds_in_impls.rs:63:20
--> $DIR/implied_bounds_in_impls.rs:62:20
|
LL | fn f() -> impl Deref + DerefMut<Target = u8> {
| ^^^^^
@ -121,7 +121,7 @@ LL + fn f() -> impl DerefMut<Target = u8> {
|
error: this bound is already specified as the supertrait of `PartialOrd`
--> $DIR/implied_bounds_in_impls.rs:74:41
--> $DIR/implied_bounds_in_impls.rs:73:41
|
LL | fn default_generic_param1() -> impl PartialEq + PartialOrd + Debug {}
| ^^^^^^^^^
@ -133,7 +133,7 @@ LL + fn default_generic_param1() -> impl PartialOrd + Debug {}
|
error: this bound is already specified as the supertrait of `PartialOrd`
--> $DIR/implied_bounds_in_impls.rs:75:54
--> $DIR/implied_bounds_in_impls.rs:74:54
|
LL | fn default_generic_param2() -> impl PartialOrd + PartialEq + Debug {}
| ^^^^^^^^^
@ -145,7 +145,7 @@ LL + fn default_generic_param2() -> impl PartialOrd + Debug {}
|
error: this bound is already specified as the supertrait of `DoubleEndedIterator`
--> $DIR/implied_bounds_in_impls.rs:88:26
--> $DIR/implied_bounds_in_impls.rs:87:26
|
LL | fn my_iter() -> impl Iterator<Item = u32> + DoubleEndedIterator {
| ^^^^^^^^^^^^^^^^^^^^
@ -157,7 +157,7 @@ LL + fn my_iter() -> impl DoubleEndedIterator<Item = u32> {
|
error: this bound is already specified as the supertrait of `Copy`
--> $DIR/implied_bounds_in_impls.rs:93:27
--> $DIR/implied_bounds_in_impls.rs:92:27
|
LL | fn f() -> impl Copy + Clone {
| ^^^^^
@ -169,7 +169,7 @@ LL + fn f() -> impl Copy {
|
error: this bound is already specified as the supertrait of `Trait2<i32>`
--> $DIR/implied_bounds_in_impls.rs:107:21
--> $DIR/implied_bounds_in_impls.rs:106:21
|
LL | fn f2() -> impl Trait1<i32, U = i64> + Trait2<i32> {}
| ^^^^^^^^^^^^^^^^^^^^
@ -181,7 +181,7 @@ LL + fn f2() -> impl Trait2<i32, U = i64> {}
|
error: this bound is already specified as the supertrait of `Trait4<i8, X = i32>`
--> $DIR/implied_bounds_in_impls.rs:122:21
--> $DIR/implied_bounds_in_impls.rs:121:21
|
LL | fn f3() -> impl Trait3<i8, i16, i64, X = i32, Y = i128> + Trait4<i8, X = i32> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,5 +1,4 @@
#![warn(clippy::unused_async)]
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;

View File

@ -1,5 +1,5 @@
error: unused `async` for function with no await statements
--> $DIR/unused_async.rs:13:5
--> $DIR/unused_async.rs:12:5
|
LL | / async fn async_block_await() {
LL | |
@ -11,7 +11,7 @@ LL | | }
|
= help: consider removing the `async` from this function
note: `await` used in an async block, which does not require the enclosing function to be `async`
--> $DIR/unused_async.rs:16:23
--> $DIR/unused_async.rs:15:23
|
LL | ready(()).await;
| ^^^^^
@ -19,7 +19,7 @@ LL | ready(()).await;
= help: to override `-D warnings` add `#[allow(clippy::unused_async)]`
error: unused `async` for function with no await statements
--> $DIR/unused_async.rs:46:5
--> $DIR/unused_async.rs:45:5
|
LL | async fn f3() {}
| ^^^^^^^^^^^^^^^^
@ -27,7 +27,7 @@ LL | async fn f3() {}
= help: consider removing the `async` from this function
error: unused `async` for function with no await statements
--> $DIR/unused_async.rs:59:1
--> $DIR/unused_async.rs:58:1
|
LL | / async fn foo() -> i32 {
LL | |
@ -38,7 +38,7 @@ LL | | }
= help: consider removing the `async` from this function
error: unused `async` for function with no await statements
--> $DIR/unused_async.rs:71:5
--> $DIR/unused_async.rs:70:5
|
LL | / async fn unused(&self) -> i32 {
LL | |

View File

@ -1,6 +1,5 @@
// edition:2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
pub trait Foo {

View File

@ -1,7 +1,6 @@
// aux-build:async-trait-dep.rs
// edition:2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
extern crate async_trait_dep;

View File

@ -1,6 +1,5 @@
// edition:2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
pub trait Meow {

View File

@ -1,4 +1,3 @@
#![feature(async_fn_in_trait)]
// edition: 2021
pub async fn load() -> i32 {

View File

@ -1,5 +1,3 @@
#![feature(return_position_impl_trait_in_trait)]
pub trait Trait {
fn create() -> impl Iterator<Item = u64> {
std::iter::empty()

View File

@ -25,7 +25,7 @@ LL | fn bar<T: Trait<method() -> (): Send>>() {}
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-inputs-and-output.rs:5:12
|
LL | #![feature(return_type_notation, async_fn_in_trait)]
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information

View File

@ -25,7 +25,7 @@ LL | fn bar<T: Trait<method() -> (): Send>>() {}
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-inputs-and-output.rs:5:12
|
LL | #![feature(return_type_notation, async_fn_in_trait)]
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information

View File

@ -1,6 +1,6 @@
// edition: 2021
#![feature(return_type_notation, async_fn_in_trait)]
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {

View File

@ -25,7 +25,7 @@ LL | fn bar<T: Trait<method() -> (): Send>>() {}
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-inputs-and-output.rs:3:12
|
LL | #![feature(return_type_notation, async_fn_in_trait)]
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information

View File

@ -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/basic.rs:8:12
|
LL | #![feature(return_type_notation, async_fn_in_trait)]
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information

View File

@ -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/basic.rs:8:12
|
LL | #![feature(return_type_notation, async_fn_in_trait)]
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information

View File

@ -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/basic.rs:8:12
|
LL | #![feature(return_type_notation, async_fn_in_trait)]
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information

View File

@ -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/basic.rs:8:12
|
LL | #![feature(return_type_notation, async_fn_in_trait)]
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information

View File

@ -2,7 +2,7 @@
// edition: 2021
// [with] check-pass
#![feature(return_type_notation, async_fn_in_trait)]
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Foo {

View File

@ -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/basic.rs:5:12
|
LL | #![feature(return_type_notation, async_fn_in_trait)]
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information

View File

@ -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/basic.rs:5:12
|
LL | #![feature(return_type_notation, async_fn_in_trait)]
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information

View File

@ -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/equality.rs:5:12
|
LL | #![feature(return_type_notation, async_fn_in_trait)]
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information

View File

@ -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/equality.rs:5:12
|
LL | #![feature(return_type_notation, async_fn_in_trait)]
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information

View File

@ -1,6 +1,6 @@
// edition: 2021
#![feature(return_type_notation, async_fn_in_trait)]
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
use std::future::Future;

View File

@ -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/equality.rs:3:12
|
LL | #![feature(return_type_notation, async_fn_in_trait)]
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information

View File

@ -1,6 +1,6 @@
// edition: 2021
#![feature(return_type_notation, async_fn_in_trait)]
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {

View File

@ -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/missing.rs:3:12
|
LL | #![feature(return_type_notation, async_fn_in_trait)]
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information

View File

@ -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`.

View File

@ -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`.

View File

@ -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() {}
}

View File

@ -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`.

View File

@ -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`.

View File

@ -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`.

View File

@ -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() {

View File

@ -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 9 previous errors
error: aborting due to 10 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`.

View File

@ -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() {}

View File

@ -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`.

View File

@ -1,9 +1,6 @@
// 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 {

View File

@ -1,7 +1,6 @@
// run-pass
// edition:2021
#![feature(async_fn_in_trait)]
use std::future::Future;

View File

@ -1,7 +1,5 @@
// edition: 2021
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;

View File

@ -1,11 +1,11 @@
error[E0053]: method `foo` has an incompatible type for trait
--> $DIR/async-example-desugared-boxed-in-trait.rs:15:5
--> $DIR/async-example-desugared-boxed-in-trait.rs:13:5
|
LL | async fn foo(&self) -> i32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
|
note: type in trait
--> $DIR/async-example-desugared-boxed-in-trait.rs:11:22
--> $DIR/async-example-desugared-boxed-in-trait.rs:9:22
|
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,7 +1,5 @@
// edition: 2021
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;

View File

@ -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:13:5
|
LL | async fn foo(&self) -> i32;
| --------------------------- required because the trait method is async

View File

@ -1,8 +1,7 @@
// check-pass
// edition: 2021
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait, lint_reasons)]
#![feature(lint_reasons)]
#![allow(incomplete_features)]
use std::future::Future;

View File

@ -1,8 +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;

View File

@ -1,7 +1,5 @@
// edition: 2021
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;

View File

@ -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:21:5
|
LL | async fn foo(&self) -> i32;
| --------------------------- required because the trait method is async

View File

@ -1,8 +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;

View File

@ -1,7 +1,6 @@
// check-pass
// edition: 2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait MyTrait {

View File

@ -2,7 +2,6 @@
// known-bug: #102682
// edition: 2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Debug;

View File

@ -1,5 +1,5 @@
error[E0311]: the parameter type `U` may not live long enough
--> $DIR/async-generics-and-bounds.rs:12:5
--> $DIR/async-generics-and-bounds.rs:11:5
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -13,7 +13,7 @@ LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: Debug + Sized, U: Has
| ++++ ++ ++ +++++++
error[E0311]: the parameter type `T` may not live long enough
--> $DIR/async-generics-and-bounds.rs:12:5
--> $DIR/async-generics-and-bounds.rs:11:5
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -2,7 +2,6 @@
// known-bug: #102682
// edition: 2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait MyTrait<T, U> {

View File

@ -1,5 +1,5 @@
error[E0311]: the parameter type `U` may not live long enough
--> $DIR/async-generics.rs:9:5
--> $DIR/async-generics.rs:8:5
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^
@ -13,7 +13,7 @@ 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:5
--> $DIR/async-generics.rs:8:5
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^

View File

@ -1,7 +1,6 @@
// check-pass
// edition: 2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Debug;

View File

@ -1,7 +1,6 @@
// check-pass
// edition: 2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait MyTrait<'a, 'b, T> {

View File

@ -1,6 +1,5 @@
// edition: 2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait MyTrait<T> {

View File

@ -1,5 +1,5 @@
error[E0733]: recursion in an `async fn` requires boxing
--> $DIR/async-recursive-generic.rs:11:5
--> $DIR/async-recursive-generic.rs:10:5
|
LL | async fn foo_recursive(&self, n: usize) -> T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive `async fn`

View File

@ -1,6 +1,5 @@
// edition: 2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait MyTrait {

View File

@ -1,5 +1,5 @@
error[E0733]: recursion in an `async fn` requires boxing
--> $DIR/async-recursive.rs:11:5
--> $DIR/async-recursive.rs:10:5
|
LL | async fn foo_recursive(&self, n: usize) -> i32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive `async fn`

View File

@ -1,7 +1,5 @@
// edition:2021
#![feature(async_fn_in_trait)]
pub trait Foo {
async fn test();
}

View File

@ -1,6 +1,5 @@
// edition:2021
#![feature(async_fn_in_trait)]
trait MyTrait {
async fn bar(&abc self);

View File

@ -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);
| -----^^^^

View File

@ -1,7 +1,6 @@
// edition: 2021
// known-bug: #108309
#![feature(async_fn_in_trait)]
#![feature(min_specialization)]
struct MyStruct;

View File

@ -1,11 +1,11 @@
error[E0053]: method `foo` has an incompatible type for trait
--> $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 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found future
|
note: type in trait
--> $DIR/dont-project-to-specializable-projection.rs:10:5
--> $DIR/dont-project-to-specializable-projection.rs:9:5
|
LL | async fn foo(_: T) -> &'static str;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -13,12 +13,12 @@ LL | async fn foo(_: T) -> &'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

View File

@ -1,7 +1,6 @@
// check-pass
// edition:2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
pub trait Foo {

View File

@ -1,7 +1,6 @@
// check-pass
// edition:2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
pub trait Foo {

View File

@ -1,6 +1,5 @@
// edition: 2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait MyTrait {

View File

@ -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

View File

@ -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 argument and return types, not in `impl` method return types
async { *self }
}
}

View File

@ -1,12 +0,0 @@
error[E0562]: `impl Trait` only allowed in function and inherent method argument and 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`.

View File

@ -1,6 +1,5 @@
// edition: 2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait Foo {

View File

@ -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 {
| ---

View File

@ -1,7 +1,6 @@
// check-pass
// edition: 2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait TcpStack {

View File

@ -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;

View File

@ -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

View File

@ -1,7 +1,6 @@
// check-pass
// edition:2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;

View File

@ -2,7 +2,6 @@
// edition:2021
// check-pass
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait T {

View File

@ -1,7 +1,6 @@
// check-pass
// edition:2021
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
pub trait SpiDevice {

View File

@ -1,7 +1,6 @@
// edition:2021
// check-pass
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;

View File

@ -1,6 +1,5 @@
// edition:2021
#![feature(async_fn_in_trait)]
trait MyTrait {
async fn foo<'a>(&self);

View File

@ -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

View File

@ -1,6 +1,5 @@
// edition:2018
#![feature(async_fn_in_trait)]
#![feature(min_specialization)]
struct MyStruct;

View File

@ -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
@ -8,13 +8,13 @@ LL | impl<T> MyTrait<T> for MyStruct {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
error[E0308]: mismatched types
--> $DIR/missing-feature-flag.rs:16:42
--> $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

View File

@ -1,6 +1,5 @@
// edition:2021
#![feature(async_fn_in_trait)]
trait Foo {
async fn bar();

View File

@ -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`

View File

@ -1,8 +1,6 @@
// edition: 2021
// check-pass
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;

View File

@ -5,7 +5,6 @@
// 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 {}

View File

@ -1,6 +1,5 @@
// edition:2021
#![feature(async_fn_in_trait)]
trait Foo {
async fn foo(&self);

View File

@ -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...

View File

@ -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);

View File

@ -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 `()`

View File

@ -1,6 +1,5 @@
// edition:2021
#![feature(return_position_impl_trait_in_trait)]
struct Wrapper<T>(T);

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More