Skip to content

Commit 5037836

Browse files
authored
Rollup merge of #108880 - spastorino:new-rpitit-6, r=compiler-errors
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.
2 parents e006ee9 + b82d6a2 commit 5037836

File tree

50 files changed

+236
-46
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+236
-46
lines changed

tests/ui/async-await/in-trait/async-associated-types.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// check-pass
22
// edition: 2021
3+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
4+
// revisions: current next
35

46
#![feature(async_fn_in_trait)]
57
#![feature(impl_trait_projections)]

tests/ui/async-await/in-trait/async-associated-types2.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// check-pass
22
// edition: 2021
3+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
4+
// revisions: current next
35

46
#![feature(async_fn_in_trait)]
57
#![feature(type_alias_impl_trait)]

tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr renamed to tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.current.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0053]: method `foo` has an incompatible type for trait
2-
--> $DIR/async-example-desugared-boxed-in-trait.rs:15:28
2+
--> $DIR/async-example-desugared-boxed-in-trait.rs:17:28
33
|
44
LL | async fn foo(&self) -> i32 {
55
| ^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
66
|
77
note: type in trait
8-
--> $DIR/async-example-desugared-boxed-in-trait.rs:11:22
8+
--> $DIR/async-example-desugared-boxed-in-trait.rs:13:22
99
|
1010
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0053]: method `foo` has an incompatible type for trait
2+
--> $DIR/async-example-desugared-boxed-in-trait.rs:17:28
3+
|
4+
LL | async fn foo(&self) -> i32 {
5+
| ^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
6+
|
7+
note: type in trait
8+
--> $DIR/async-example-desugared-boxed-in-trait.rs:13:22
9+
|
10+
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
= note: expected signature `fn(&i32) -> Pin<Box<dyn Future<Output = i32>>>`
13+
found signature `fn(&i32) -> impl Future<Output = i32>`
14+
15+
error: aborting due to previous error
16+
17+
For more information about this error, try `rustc --explain E0053`.

tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// edition: 2021
2+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
3+
// revisions: current next
24

35
#![feature(async_fn_in_trait)]
46
#![feature(return_position_impl_trait_in_trait)]

tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr renamed to tests/ui/async-await/in-trait/async-example-desugared-boxed.current.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: method `foo` should be async because the method from the trait is async
2-
--> $DIR/async-example-desugared-boxed.rs:15:5
2+
--> $DIR/async-example-desugared-boxed.rs:17:5
33
|
44
LL | async fn foo(&self) -> i32;
55
| --------------------------- required because the trait method is async
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: method `foo` should be async because the method from the trait is async
2+
--> $DIR/async-example-desugared-boxed.rs:17:5
3+
|
4+
LL | async fn foo(&self) -> i32;
5+
| --------------------------- required because the trait method is async
6+
...
7+
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>> {
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9+
10+
error: aborting due to previous error
11+

tests/ui/async-await/in-trait/async-example-desugared-boxed.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// edition: 2021
2+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
3+
// revisions: current next
24

35
#![feature(async_fn_in_trait)]
46
#![feature(return_position_impl_trait_in_trait)]

tests/ui/async-await/in-trait/async-example-desugared-extra.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// check-pass
22
// edition: 2021
3+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
4+
// revisions: current next
35

46
#![feature(async_fn_in_trait)]
57
#![feature(return_position_impl_trait_in_trait)]

tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// check-pass
22
// edition: 2021
3+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
4+
// revisions: current next
35

46
#![feature(async_fn_in_trait)]
57
#![feature(return_position_impl_trait_in_trait)]

tests/ui/async-await/in-trait/async-example-desugared-manual.stderr renamed to tests/ui/async-await/in-trait/async-example-desugared-manual.current.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: method `foo` should be async because the method from the trait is async
2-
--> $DIR/async-example-desugared-manual.rs:23:5
2+
--> $DIR/async-example-desugared-manual.rs:25:5
33
|
44
LL | async fn foo(&self) -> i32;
55
| --------------------------- required because the trait method is async
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: method `foo` should be async because the method from the trait is async
2+
--> $DIR/async-example-desugared-manual.rs:25:5
3+
|
4+
LL | async fn foo(&self) -> i32;
5+
| --------------------------- required because the trait method is async
6+
...
7+
LL | fn foo(&self) -> MyFuture {
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
9+
10+
error: aborting due to previous error
11+

tests/ui/async-await/in-trait/async-example-desugared-manual.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// edition: 2021
2+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
3+
// revisions: current next
24

35
#![feature(async_fn_in_trait)]
46
#![feature(return_position_impl_trait_in_trait)]

tests/ui/async-await/in-trait/async-example-desugared.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// check-pass
22
// edition: 2021
3+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
4+
// revisions: current next
35

46
#![feature(async_fn_in_trait)]
57
#![feature(return_position_impl_trait_in_trait)]

tests/ui/async-await/in-trait/async-recursive-generic.stderr renamed to tests/ui/async-await/in-trait/async-recursive-generic.current.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0733]: recursion in an `async fn` requires boxing
2-
--> $DIR/async-recursive-generic.rs:11:48
2+
--> $DIR/async-recursive-generic.rs:13:48
33
|
44
LL | async fn foo_recursive(&self, n: usize) -> T {
55
| ^ recursive `async fn`
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0733]: recursion in an `async fn` requires boxing
2+
--> $DIR/async-recursive-generic.rs:13:48
3+
|
4+
LL | async fn foo_recursive(&self, n: usize) -> T {
5+
| ^ recursive `async fn`
6+
|
7+
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
8+
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0733`.

tests/ui/async-await/in-trait/async-recursive-generic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// edition: 2021
2+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
3+
// revisions: current next
24

35
#![feature(async_fn_in_trait)]
46
#![allow(incomplete_features)]

tests/ui/async-await/in-trait/async-recursive.stderr renamed to tests/ui/async-await/in-trait/async-recursive.current.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0733]: recursion in an `async fn` requires boxing
2-
--> $DIR/async-recursive.rs:11:48
2+
--> $DIR/async-recursive.rs:13:48
33
|
44
LL | async fn foo_recursive(&self, n: usize) -> i32 {
55
| ^^^ recursive `async fn`
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0733]: recursion in an `async fn` requires boxing
2+
--> $DIR/async-recursive.rs:13:48
3+
|
4+
LL | async fn foo_recursive(&self, n: usize) -> i32 {
5+
| ^^^ recursive `async fn`
6+
|
7+
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
8+
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0733`.

tests/ui/async-await/in-trait/async-recursive.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// edition: 2021
2+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
3+
// revisions: current next
24

35
#![feature(async_fn_in_trait)]
46
#![allow(incomplete_features)]

tests/ui/async-await/in-trait/bad-signatures.stderr renamed to tests/ui/async-await/in-trait/bad-signatures.current.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: expected identifier, found keyword `self`
2-
--> $DIR/bad-signatures.rs:7:23
2+
--> $DIR/bad-signatures.rs:9:23
33
|
44
LL | async fn bar(&abc self);
55
| ^^^^ expected identifier, found keyword
66

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

1616
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
17-
--> $DIR/bad-signatures.rs:3:12
17+
--> $DIR/bad-signatures.rs:5:12
1818
|
1919
LL | #![feature(async_fn_in_trait)]
2020
| ^^^^^^^^^^^^^^^^^
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error: expected identifier, found keyword `self`
2+
--> $DIR/bad-signatures.rs:9:23
3+
|
4+
LL | async fn bar(&abc self);
5+
| ^^^^ expected identifier, found keyword
6+
7+
error: expected one of `:`, `@`, or `|`, found keyword `self`
8+
--> $DIR/bad-signatures.rs:9:23
9+
|
10+
LL | async fn bar(&abc self);
11+
| -----^^^^
12+
| | |
13+
| | expected one of `:`, `@`, or `|`
14+
| help: declare the type after the parameter binding: `<identifier>: <type>`
15+
16+
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
17+
--> $DIR/bad-signatures.rs:5:12
18+
|
19+
LL | #![feature(async_fn_in_trait)]
20+
| ^^^^^^^^^^^^^^^^^
21+
|
22+
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
23+
= note: `#[warn(incomplete_features)]` on by default
24+
25+
error: aborting due to 2 previous errors; 1 warning emitted
26+

tests/ui/async-await/in-trait/bad-signatures.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// edition:2021
2+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
3+
// revisions: current next
24

35
#![feature(async_fn_in_trait)]
46
//~^ WARN the feature `async_fn_in_trait` is incomplete

tests/ui/async-await/in-trait/early-bound-1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// check-pass
22
// edition:2021
3+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
4+
// revisions: current next
35

46
#![feature(async_fn_in_trait)]
57
#![allow(incomplete_features)]

tests/ui/async-await/in-trait/early-bound-2.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// check-pass
22
// edition:2021
3+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
4+
// revisions: current next
35

46
#![feature(async_fn_in_trait)]
57
#![allow(incomplete_features)]

tests/ui/async-await/in-trait/fn-not-async-err2.stderr renamed to tests/ui/async-await/in-trait/fn-not-async-err2.current.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
2-
--> $DIR/fn-not-async-err2.rs:13:22
2+
--> $DIR/fn-not-async-err2.rs:15:22
33
|
44
LL | fn foo(&self) -> impl Future<Output = i32> {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
2+
--> $DIR/fn-not-async-err2.rs:15:22
3+
|
4+
LL | fn foo(&self) -> impl Future<Output = i32> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
8+
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0562`.

tests/ui/async-await/in-trait/fn-not-async-err2.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// edition: 2021
2+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
3+
// revisions: current next
24

35
#![feature(async_fn_in_trait)]
46
#![allow(incomplete_features)]

tests/ui/async-await/in-trait/implied-bounds.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// check-pass
22
// edition: 2021
3+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
4+
// revisions: current next
35

46
#![feature(async_fn_in_trait)]
57
#![allow(incomplete_features)]

tests/ui/async-await/in-trait/issue-102138.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// check-pass
22
// edition:2021
3+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
4+
// revisions: current next
35

46
#![feature(async_fn_in_trait)]
57
#![allow(incomplete_features)]

tests/ui/async-await/in-trait/issue-102219.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// compile-flags:--crate-type=lib
22
// edition:2021
33
// check-pass
4+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
5+
// revisions: current next
46

57
#![feature(async_fn_in_trait)]
68
#![allow(incomplete_features)]

tests/ui/impl-trait/in-trait/deep-match-works.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// check-pass
2+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
3+
// revisions: current next
24

35
#![feature(return_position_impl_trait_in_trait)]
46
#![allow(incomplete_features)]
@@ -10,7 +12,9 @@ trait Foo {
1012
}
1113

1214
impl Foo for () {
13-
fn bar() -> Wrapper<i32> { Wrapper(0) }
15+
fn bar() -> Wrapper<i32> {
16+
Wrapper(0)
17+
}
1418
}
1519

1620
fn main() {}

tests/ui/impl-trait/in-trait/deep-match.stderr renamed to tests/ui/impl-trait/in-trait/deep-match.current.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0053]: method `bar` has an incompatible return type for trait
2-
--> $DIR/deep-match.rs:11:17
2+
--> $DIR/deep-match.rs:14:17
33
|
4-
LL | fn bar() -> i32 { 0 }
4+
LL | fn bar() -> i32 {
55
| ^^^
66
| |
77
| expected `Wrapper<_>`, found `i32`
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0053]: method `bar` has an incompatible return type for trait
2+
--> $DIR/deep-match.rs:14:17
3+
|
4+
LL | fn bar() -> i32 {
5+
| ^^^
6+
| |
7+
| expected `Wrapper<_>`, found `i32`
8+
| return type in trait
9+
|
10+
= note: expected struct `Wrapper<_>`
11+
found type `i32`
12+
13+
error: aborting due to previous error
14+
15+
For more information about this error, try `rustc --explain E0053`.

tests/ui/impl-trait/in-trait/deep-match.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
2+
// revisions: current next
3+
14
#![feature(return_position_impl_trait_in_trait)]
25
#![allow(incomplete_features)]
36

@@ -8,8 +11,10 @@ trait Foo {
811
}
912

1013
impl Foo for () {
11-
fn bar() -> i32 { 0 }
12-
//~^ ERROR method `bar` has an incompatible return type for trait
14+
fn bar() -> i32 {
15+
//~^ ERROR method `bar` has an incompatible return type for trait
16+
0
17+
}
1318
}
1419

1520
fn main() {}

tests/ui/impl-trait/in-trait/default-method-binder-shifting.stderr renamed to tests/ui/impl-trait/in-trait/default-method-binder-shifting.current.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/default-method-binder-shifting.rs:3:12
2+
--> $DIR/default-method-binder-shifting.rs:5:12
33
|
44
LL | #![feature(return_position_impl_trait_in_trait)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/default-method-binder-shifting.rs:5:12
3+
|
4+
LL | #![feature(return_position_impl_trait_in_trait)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
8+
= note: `#[warn(incomplete_features)]` on by default
9+
10+
warning: 1 warning emitted
11+

tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// check-pass
2+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
3+
// revisions: current next
24

35
#![feature(return_position_impl_trait_in_trait)]
46
//~^ WARN the feature `return_position_impl_trait_in_trait` is incomplete

0 commit comments

Comments
 (0)