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.
This commit is contained in:
Matthias Krüger 2023-03-14 17:40:03 +01:00 committed by GitHub
commit 5037836daa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 236 additions and 46 deletions

View File

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

View File

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

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: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> + '_>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

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

View File

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

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

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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

View 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

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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)]
@ -10,7 +12,9 @@ trait Foo {
}
impl Foo for () {
fn bar() -> Wrapper<i32> { Wrapper(0) }
fn bar() -> Wrapper<i32> {
Wrapper(0)
}
}
fn main() {}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,7 @@
// build-pass
// compile-flags: --crate-type=lib
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]

View File

@ -1,17 +0,0 @@
// check-pass
// compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
trait Foo {
fn foo() -> impl Sized;
}
impl Foo for String {
fn foo() -> i32 {
22
}
}
fn main() {}

View File

@ -1,11 +0,0 @@
// check-pass
// compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
trait Foo {
fn foo() -> impl Sized;
}
fn main() {}

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/opaque-in-impl-is-opaque.rs:17:19
--> $DIR/opaque-in-impl-is-opaque.rs:20:19
|
LL | fn bar(&self) -> impl Display {
| ------------ the found opaque type

View File

@ -0,0 +1,17 @@
error[E0308]: mismatched types
--> $DIR/opaque-in-impl-is-opaque.rs:20:19
|
LL | fn bar(&self) -> impl Display {
| ------------ the found opaque type
...
LL | let x: &str = ().bar();
| ---- ^^^^^^^^ expected `&str`, found opaque type
| |
| expected due to this
|
= note: expected reference `&str`
found opaque type `impl std::fmt::Display`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.

View File

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

View File

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

View File

@ -1,5 +1,5 @@
error: `impl` item signature doesn't match `trait` item signature
--> $DIR/signature-mismatch.rs:15:5
--> $DIR/signature-mismatch.rs:17:5
|
LL | fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>;
| ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '3`

View File

@ -0,0 +1,16 @@
error: `impl` item signature doesn't match `trait` item signature
--> $DIR/signature-mismatch.rs:17:5
|
LL | fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>;
| ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '3`
...
LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2`
|
= note: expected signature `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '3`
found signature `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2`
= help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`
= help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output
error: aborting due to previous error

View File

@ -1,4 +1,6 @@
// edition:2021
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]

View File

@ -1,4 +1,6 @@
// check-pass
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next
#![feature(specialization)]
#![feature(return_position_impl_trait_in_trait)]

View File

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