Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove tests/ui/impl-trait/in-trait/new-lowering-strategy in favor of using revisions on existing tests #108880

Merged
merged 3 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/async-associated-types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// check-pass
// edition: 2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![feature(impl_trait_projections)]
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/async-associated-types2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// check-pass
// edition: 2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![feature(type_alias_impl_trait)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error[E0053]: method `foo` has an incompatible type for trait
--> $DIR/async-example-desugared-boxed-in-trait.rs:15:28
--> $DIR/async-example-desugared-boxed-in-trait.rs:17:28
|
LL | async fn foo(&self) -> i32 {
| ^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
|
note: type in trait
--> $DIR/async-example-desugared-boxed-in-trait.rs:11:22
--> $DIR/async-example-desugared-boxed-in-trait.rs:13:22
|
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -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`.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// edition: 2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: method `foo` should be async because the method from the trait is async
--> $DIR/async-example-desugared-boxed.rs:15:5
--> $DIR/async-example-desugared-boxed.rs:17:5
|
LL | async fn foo(&self) -> i32;
| --------------------------- required because the trait method is async
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// edition: 2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// check-pass
// edition: 2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// check-pass
// edition: 2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: method `foo` should be async because the method from the trait is async
--> $DIR/async-example-desugared-manual.rs:23:5
--> $DIR/async-example-desugared-manual.rs:25:5
|
LL | async fn foo(&self) -> i32;
| --------------------------- required because the trait method is async
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// edition: 2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/async-example-desugared.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// check-pass
// edition: 2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0733]: recursion in an `async fn` requires boxing
--> $DIR/async-recursive-generic.rs:11:48
--> $DIR/async-recursive-generic.rs:13:48
|
LL | async fn foo_recursive(&self, n: usize) -> T {
| ^ recursive `async fn`
Expand Down
12 changes: 12 additions & 0 deletions tests/ui/async-await/in-trait/async-recursive-generic.next.stderr
Original file line number Diff line number Diff line change
@@ -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`.
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/async-recursive-generic.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// edition: 2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0733]: recursion in an `async fn` requires boxing
--> $DIR/async-recursive.rs:11:48
--> $DIR/async-recursive.rs:13:48
|
LL | async fn foo_recursive(&self, n: usize) -> i32 {
| ^^^ recursive `async fn`
Expand Down
12 changes: 12 additions & 0 deletions tests/ui/async-await/in-trait/async-recursive.next.stderr
Original file line number Diff line number Diff line change
@@ -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`.
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/async-recursive.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// edition: 2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: expected identifier, found keyword `self`
--> $DIR/bad-signatures.rs:7:23
--> $DIR/bad-signatures.rs:9:23
|
LL | async fn bar(&abc self);
| ^^^^ expected identifier, found keyword

error: expected one of `:`, `@`, or `|`, found keyword `self`
--> $DIR/bad-signatures.rs:7:23
--> $DIR/bad-signatures.rs:9:23
|
LL | async fn bar(&abc self);
| -----^^^^
Expand All @@ -14,7 +14,7 @@ LL | async fn bar(&abc self);
| help: declare the type after the parameter binding: `<identifier>: <type>`

warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-signatures.rs:3:12
--> $DIR/bad-signatures.rs:5:12
|
LL | #![feature(async_fn_in_trait)]
| ^^^^^^^^^^^^^^^^^
Expand Down
26 changes: 26 additions & 0 deletions tests/ui/async-await/in-trait/bad-signatures.next.stderr
Original file line number Diff line number Diff line change
@@ -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

2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/bad-signatures.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// edition:2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
//~^ WARN the feature `async_fn_in_trait` is incomplete
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/early-bound-1.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// check-pass
// edition:2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/early-bound-2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// check-pass
// edition:2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
--> $DIR/fn-not-async-err2.rs:13:22
--> $DIR/fn-not-async-err2.rs:15:22
|
LL | fn foo(&self) -> impl Future<Output = i32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
12 changes: 12 additions & 0 deletions tests/ui/async-await/in-trait/fn-not-async-err2.next.stderr
Original file line number Diff line number Diff line change
@@ -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`.
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/fn-not-async-err2.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// edition: 2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/implied-bounds.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// check-pass
// edition: 2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/issue-102138.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// check-pass
// edition:2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/async-await/in-trait/issue-102219.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// compile-flags:--crate-type=lib
// edition:2021
// check-pass
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
Expand Down
6 changes: 5 additions & 1 deletion tests/ui/impl-trait/in-trait/deep-match-works.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// check-pass
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
Expand All @@ -10,7 +12,9 @@ trait Foo {
}

impl Foo for () {
fn bar() -> Wrapper<i32> { Wrapper(0) }
fn bar() -> Wrapper<i32> {
Wrapper(0)
}
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error[E0053]: method `bar` has an incompatible return type for trait
--> $DIR/deep-match.rs:11:17
--> $DIR/deep-match.rs:14:17
|
LL | fn bar() -> i32 { 0 }
LL | fn bar() -> i32 {
| ^^^
| |
| expected `Wrapper<_>`, found `i32`
Expand Down
15 changes: 15 additions & 0 deletions tests/ui/impl-trait/in-trait/deep-match.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error[E0053]: method `bar` has an incompatible return type for trait
--> $DIR/deep-match.rs:14:17
|
LL | fn bar() -> i32 {
| ^^^
| |
| expected `Wrapper<_>`, found `i32`
| return type in trait
|
= note: expected struct `Wrapper<_>`
found type `i32`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0053`.
9 changes: 7 additions & 2 deletions tests/ui/impl-trait/in-trait/deep-match.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]

Expand All @@ -8,8 +11,10 @@ trait Foo {
}

impl Foo for () {
fn bar() -> i32 { 0 }
//~^ ERROR method `bar` has an incompatible return type for trait
fn bar() -> i32 {
//~^ ERROR method `bar` has an incompatible return type for trait
0
}
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/default-method-binder-shifting.rs:3:12
--> $DIR/default-method-binder-shifting.rs:5:12
|
LL | #![feature(return_position_impl_trait_in_trait)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/default-method-binder-shifting.rs:5:12
|
LL | #![feature(return_position_impl_trait_in_trait)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
= note: `#[warn(incomplete_features)]` on by default

warning: 1 warning emitted

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// check-pass
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

#![feature(return_position_impl_trait_in_trait)]
//~^ WARN the feature `return_position_impl_trait_in_trait` is incomplete
Expand Down
Loading