Skip to content

Commit

Permalink
Rollup merge of #108880 - spastorino:new-rpitit-6, r=compiler-errors
Browse files Browse the repository at this point in the history
Remove tests/ui/impl-trait/in-trait/new-lowering-strategy in favor of using revisions on existing tests

r? `@compiler-errors`

This one again sits on top of existing approved PRs and it still needs to add revisions to tests in `tests/ui/impl-trait/in-trait` as it only does so for async in traits.
  • Loading branch information
matthiaskrgr authored Mar 14, 2023
2 parents e006ee9 + b82d6a2 commit 5037836
Show file tree
Hide file tree
Showing 50 changed files with 236 additions and 46 deletions.
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

0 comments on commit 5037836

Please sign in to comment.