mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 03:38:29 +00:00
Run existing async in traits tests using -Zlower-impl-trait-in-trait-to-assoc-ty
This commit is contained in:
parent
8a5574bf62
commit
07e018dfef
@ -1,5 +1,7 @@
|
|||||||
// check-pass
|
// check-pass
|
||||||
// edition: 2021
|
// edition: 2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![feature(impl_trait_projections)]
|
#![feature(impl_trait_projections)]
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// check-pass
|
// check-pass
|
||||||
// edition: 2021
|
// edition: 2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![feature(type_alias_impl_trait)]
|
#![feature(type_alias_impl_trait)]
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
error[E0053]: method `foo` has an incompatible type for trait
|
error[E0053]: method `foo` has an incompatible type for trait
|
||||||
--> $DIR/async-example-desugared-boxed-in-trait.rs:15:28
|
--> $DIR/async-example-desugared-boxed-in-trait.rs:17:28
|
||||||
|
|
|
|
||||||
LL | async fn foo(&self) -> i32 {
|
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
|
note: type in trait
|
||||||
--> $DIR/async-example-desugared-boxed-in-trait.rs:11:22
|
--> $DIR/async-example-desugared-boxed-in-trait.rs:13:22
|
||||||
|
|
|
|
||||||
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
|
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
@ -0,0 +1,17 @@
|
|||||||
|
error[E0053]: method `foo` has an incompatible type for trait
|
||||||
|
--> $DIR/async-example-desugared-boxed-in-trait.rs:17:28
|
||||||
|
|
|
||||||
|
LL | async fn foo(&self) -> i32 {
|
||||||
|
| ^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
|
||||||
|
|
|
||||||
|
note: type in trait
|
||||||
|
--> $DIR/async-example-desugared-boxed-in-trait.rs:13:22
|
||||||
|
|
|
||||||
|
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
= note: expected signature `fn(&i32) -> Pin<Box<dyn Future<Output = i32>>>`
|
||||||
|
found signature `fn(&i32) -> impl Future<Output = i32>`
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0053`.
|
@ -1,4 +1,6 @@
|
|||||||
// edition: 2021
|
// edition: 2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![feature(return_position_impl_trait_in_trait)]
|
#![feature(return_position_impl_trait_in_trait)]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error: method `foo` should be async because the method from the trait is async
|
error: method `foo` should be async because the method from the trait is async
|
||||||
--> $DIR/async-example-desugared-boxed.rs:15:5
|
--> $DIR/async-example-desugared-boxed.rs:17:5
|
||||||
|
|
|
|
||||||
LL | async fn foo(&self) -> i32;
|
LL | async fn foo(&self) -> i32;
|
||||||
| --------------------------- required because the trait method is async
|
| --------------------------- required because the trait method is async
|
@ -0,0 +1,11 @@
|
|||||||
|
error: method `foo` should be async because the method from the trait is async
|
||||||
|
--> $DIR/async-example-desugared-boxed.rs:17:5
|
||||||
|
|
|
||||||
|
LL | async fn foo(&self) -> i32;
|
||||||
|
| --------------------------- required because the trait method is async
|
||||||
|
...
|
||||||
|
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>> {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
@ -1,4 +1,6 @@
|
|||||||
// edition: 2021
|
// edition: 2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![feature(return_position_impl_trait_in_trait)]
|
#![feature(return_position_impl_trait_in_trait)]
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// check-pass
|
// check-pass
|
||||||
// edition: 2021
|
// edition: 2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![feature(return_position_impl_trait_in_trait)]
|
#![feature(return_position_impl_trait_in_trait)]
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// check-pass
|
// check-pass
|
||||||
// edition: 2021
|
// edition: 2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![feature(return_position_impl_trait_in_trait)]
|
#![feature(return_position_impl_trait_in_trait)]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error: method `foo` should be async because the method from the trait is async
|
error: method `foo` should be async because the method from the trait is async
|
||||||
--> $DIR/async-example-desugared-manual.rs:23:5
|
--> $DIR/async-example-desugared-manual.rs:25:5
|
||||||
|
|
|
|
||||||
LL | async fn foo(&self) -> i32;
|
LL | async fn foo(&self) -> i32;
|
||||||
| --------------------------- required because the trait method is async
|
| --------------------------- required because the trait method is async
|
@ -0,0 +1,11 @@
|
|||||||
|
error: method `foo` should be async because the method from the trait is async
|
||||||
|
--> $DIR/async-example-desugared-manual.rs:25:5
|
||||||
|
|
|
||||||
|
LL | async fn foo(&self) -> i32;
|
||||||
|
| --------------------------- required because the trait method is async
|
||||||
|
...
|
||||||
|
LL | fn foo(&self) -> MyFuture {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
@ -1,4 +1,6 @@
|
|||||||
// edition: 2021
|
// edition: 2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![feature(return_position_impl_trait_in_trait)]
|
#![feature(return_position_impl_trait_in_trait)]
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// check-pass
|
// check-pass
|
||||||
// edition: 2021
|
// edition: 2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![feature(return_position_impl_trait_in_trait)]
|
#![feature(return_position_impl_trait_in_trait)]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0733]: recursion in an `async fn` requires boxing
|
error[E0733]: recursion in an `async fn` requires boxing
|
||||||
--> $DIR/async-recursive-generic.rs:11:48
|
--> $DIR/async-recursive-generic.rs:13:48
|
||||||
|
|
|
|
||||||
LL | async fn foo_recursive(&self, n: usize) -> T {
|
LL | async fn foo_recursive(&self, n: usize) -> T {
|
||||||
| ^ recursive `async fn`
|
| ^ recursive `async fn`
|
@ -0,0 +1,12 @@
|
|||||||
|
error[E0733]: recursion in an `async fn` requires boxing
|
||||||
|
--> $DIR/async-recursive-generic.rs:13:48
|
||||||
|
|
|
||||||
|
LL | async fn foo_recursive(&self, n: usize) -> T {
|
||||||
|
| ^ recursive `async fn`
|
||||||
|
|
|
||||||
|
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
|
||||||
|
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0733`.
|
@ -1,4 +1,6 @@
|
|||||||
// edition: 2021
|
// edition: 2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0733]: recursion in an `async fn` requires boxing
|
error[E0733]: recursion in an `async fn` requires boxing
|
||||||
--> $DIR/async-recursive.rs:11:48
|
--> $DIR/async-recursive.rs:13:48
|
||||||
|
|
|
|
||||||
LL | async fn foo_recursive(&self, n: usize) -> i32 {
|
LL | async fn foo_recursive(&self, n: usize) -> i32 {
|
||||||
| ^^^ recursive `async fn`
|
| ^^^ recursive `async fn`
|
12
tests/ui/async-await/in-trait/async-recursive.next.stderr
Normal file
12
tests/ui/async-await/in-trait/async-recursive.next.stderr
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
error[E0733]: recursion in an `async fn` requires boxing
|
||||||
|
--> $DIR/async-recursive.rs:13:48
|
||||||
|
|
|
||||||
|
LL | async fn foo_recursive(&self, n: usize) -> i32 {
|
||||||
|
| ^^^ recursive `async fn`
|
||||||
|
|
|
||||||
|
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
|
||||||
|
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0733`.
|
@ -1,4 +1,6 @@
|
|||||||
// edition: 2021
|
// edition: 2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
error: expected identifier, found keyword `self`
|
error: expected identifier, found keyword `self`
|
||||||
--> $DIR/bad-signatures.rs:7:23
|
--> $DIR/bad-signatures.rs:9:23
|
||||||
|
|
|
|
||||||
LL | async fn bar(&abc self);
|
LL | async fn bar(&abc self);
|
||||||
| ^^^^ expected identifier, found keyword
|
| ^^^^ expected identifier, found keyword
|
||||||
|
|
||||||
error: expected one of `:`, `@`, or `|`, found keyword `self`
|
error: expected one of `:`, `@`, or `|`, found keyword `self`
|
||||||
--> $DIR/bad-signatures.rs:7:23
|
--> $DIR/bad-signatures.rs:9:23
|
||||||
|
|
|
|
||||||
LL | async fn bar(&abc self);
|
LL | async fn bar(&abc self);
|
||||||
| -----^^^^
|
| -----^^^^
|
||||||
@ -14,7 +14,7 @@ LL | async fn bar(&abc self);
|
|||||||
| help: declare the type after the parameter binding: `<identifier>: <type>`
|
| help: declare the type after the parameter binding: `<identifier>: <type>`
|
||||||
|
|
||||||
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
|
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||||
--> $DIR/bad-signatures.rs:3:12
|
--> $DIR/bad-signatures.rs:5:12
|
||||||
|
|
|
|
||||||
LL | #![feature(async_fn_in_trait)]
|
LL | #![feature(async_fn_in_trait)]
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
26
tests/ui/async-await/in-trait/bad-signatures.next.stderr
Normal file
26
tests/ui/async-await/in-trait/bad-signatures.next.stderr
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
error: expected identifier, found keyword `self`
|
||||||
|
--> $DIR/bad-signatures.rs:9:23
|
||||||
|
|
|
||||||
|
LL | async fn bar(&abc self);
|
||||||
|
| ^^^^ expected identifier, found keyword
|
||||||
|
|
||||||
|
error: expected one of `:`, `@`, or `|`, found keyword `self`
|
||||||
|
--> $DIR/bad-signatures.rs:9:23
|
||||||
|
|
|
||||||
|
LL | async fn bar(&abc self);
|
||||||
|
| -----^^^^
|
||||||
|
| | |
|
||||||
|
| | expected one of `:`, `@`, or `|`
|
||||||
|
| help: declare the type after the parameter binding: `<identifier>: <type>`
|
||||||
|
|
||||||
|
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||||
|
--> $DIR/bad-signatures.rs:5:12
|
||||||
|
|
|
||||||
|
LL | #![feature(async_fn_in_trait)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= note: `#[warn(incomplete_features)]` on by default
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors; 1 warning emitted
|
||||||
|
|
@ -1,4 +1,6 @@
|
|||||||
// edition:2021
|
// edition:2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
//~^ WARN the feature `async_fn_in_trait` is incomplete
|
//~^ WARN the feature `async_fn_in_trait` is incomplete
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// check-pass
|
// check-pass
|
||||||
// edition:2021
|
// edition:2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// check-pass
|
// check-pass
|
||||||
// edition:2021
|
// edition:2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
|
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
|
||||||
--> $DIR/fn-not-async-err2.rs:13:22
|
--> $DIR/fn-not-async-err2.rs:15:22
|
||||||
|
|
|
|
||||||
LL | fn foo(&self) -> impl Future<Output = i32> {
|
LL | fn foo(&self) -> impl Future<Output = i32> {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
12
tests/ui/async-await/in-trait/fn-not-async-err2.next.stderr
Normal file
12
tests/ui/async-await/in-trait/fn-not-async-err2.next.stderr
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
|
||||||
|
--> $DIR/fn-not-async-err2.rs:15:22
|
||||||
|
|
|
||||||
|
LL | fn foo(&self) -> impl Future<Output = i32> {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0562`.
|
@ -1,4 +1,6 @@
|
|||||||
// edition: 2021
|
// edition: 2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// check-pass
|
// check-pass
|
||||||
// edition: 2021
|
// edition: 2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// check-pass
|
// check-pass
|
||||||
// edition:2021
|
// edition:2021
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// compile-flags:--crate-type=lib
|
// compile-flags:--crate-type=lib
|
||||||
// edition:2021
|
// edition:2021
|
||||||
// check-pass
|
// check-pass
|
||||||
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||||
|
// revisions: current next
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
Loading…
Reference in New Issue
Block a user