-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #112611 - compiler-errors:unconstrained-lt-in-rpitit,…
… r=oli-obk Error on unconstrained lifetime in RPITIT Fixes #109468 The only thing is that I had to split `tests/ui/impl-trait/in-trait/method-signature-matches.rs` into a bunch of different revisions because some error aren't being emitted if all the different examples are all together in one file 🤔 r? `@oli-obk` just because i know you'll review it, feel free to re-roll
- Loading branch information
Showing
12 changed files
with
188 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
error[E0053]: method `early` has an incompatible type for trait | ||
--> $DIR/method-signature-matches.rs:58:27 | ||
| | ||
LL | fn early<'late, T>(_: &'late ()) {} | ||
| - ^^^^^^^^^ | ||
| | | | ||
| | expected type parameter `T`, found `()` | ||
| | help: change the parameter type to match the trait: `&'early T` | ||
| this type parameter | ||
| | ||
note: type in trait | ||
--> $DIR/method-signature-matches.rs:53:28 | ||
| | ||
LL | fn early<'early, T>(x: &'early T) -> impl Sized; | ||
| ^^^^^^^^^ | ||
= note: expected signature `fn(&'early T)` | ||
found signature `fn(&())` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0053`. |
20 changes: 20 additions & 0 deletions
20
tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error[E0053]: method `owo` has an incompatible type for trait | ||
--> $DIR/method-signature-matches.rs:14:15 | ||
| | ||
LL | fn owo(_: u8) {} | ||
| ^^ | ||
| | | ||
| expected `()`, found `u8` | ||
| help: change the parameter type to match the trait: `()` | ||
| | ||
note: type in trait | ||
--> $DIR/method-signature-matches.rs:9:15 | ||
| | ||
LL | fn owo(x: ()) -> impl Sized; | ||
| ^^ | ||
= note: expected signature `fn(())` | ||
found signature `fn(u8)` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0053`. |
20 changes: 20 additions & 0 deletions
20
tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error[E0053]: method `owo` has an incompatible type for trait | ||
--> $DIR/method-signature-matches.rs:25:21 | ||
| | ||
LL | async fn owo(_: u8) {} | ||
| ^^ | ||
| | | ||
| expected `()`, found `u8` | ||
| help: change the parameter type to match the trait: `()` | ||
| | ||
note: type in trait | ||
--> $DIR/method-signature-matches.rs:20:21 | ||
| | ||
LL | async fn owo(x: ()) {} | ||
| ^^ | ||
= note: expected signature `fn(()) -> _` | ||
found signature `fn(u8) -> _` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0053`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,62 @@ | ||
// edition: 2021 | ||
// revisions: mismatch mismatch_async too_many too_few lt | ||
|
||
#![feature(return_position_impl_trait_in_trait, async_fn_in_trait)] | ||
#![allow(incomplete_features)] | ||
|
||
#[cfg(mismatch)] | ||
trait Uwu { | ||
fn owo(x: ()) -> impl Sized; | ||
} | ||
|
||
#[cfg(mismatch)] | ||
impl Uwu for () { | ||
fn owo(_: u8) {} | ||
//~^ ERROR method `owo` has an incompatible type for trait | ||
//[mismatch]~^ ERROR method `owo` has an incompatible type for trait | ||
} | ||
|
||
#[cfg(mismatch_async)] | ||
trait AsyncUwu { | ||
async fn owo(x: ()) {} | ||
} | ||
|
||
#[cfg(mismatch_async)] | ||
impl AsyncUwu for () { | ||
async fn owo(_: u8) {} | ||
//~^ ERROR method `owo` has an incompatible type for trait | ||
//[mismatch_async]~^ ERROR method `owo` has an incompatible type for trait | ||
} | ||
|
||
#[cfg(too_many)] | ||
trait TooMuch { | ||
fn calm_down_please() -> impl Sized; | ||
} | ||
|
||
#[cfg(too_many)] | ||
impl TooMuch for () { | ||
fn calm_down_please(_: (), _: (), _: ()) {} | ||
//~^ ERROR method `calm_down_please` has 3 parameters but the declaration in trait `TooMuch::calm_down_please` has 0 | ||
//[too_many]~^ ERROR method `calm_down_please` has 3 parameters but the declaration in trait `TooMuch::calm_down_please` has 0 | ||
} | ||
|
||
#[cfg(too_few)] | ||
trait TooLittle { | ||
fn come_on_a_little_more_effort(_: (), _: (), _: ()) -> impl Sized; | ||
} | ||
|
||
#[cfg(too_few)] | ||
impl TooLittle for () { | ||
fn come_on_a_little_more_effort() {} | ||
//~^ ERROR method `come_on_a_little_more_effort` has 0 parameters but the declaration in trait `TooLittle::come_on_a_little_more_effort` has 3 | ||
//[too_few]~^ ERROR method `come_on_a_little_more_effort` has 0 parameters but the declaration in trait `TooLittle::come_on_a_little_more_effort` has 3 | ||
} | ||
|
||
#[cfg(lt)] | ||
trait Lifetimes { | ||
fn early<'early, T>(x: &'early T) -> impl Sized; | ||
} | ||
|
||
#[cfg(lt)] | ||
impl Lifetimes for () { | ||
fn early<'late, T>(_: &'late ()) {} | ||
//~^ ERROR method `early` has an incompatible type for trait | ||
//[lt]~^ ERROR method `early` has an incompatible type for trait | ||
} | ||
|
||
fn main() {} |
74 changes: 0 additions & 74 deletions
74
tests/ui/impl-trait/in-trait/method-signature-matches.stderr
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0050]: method `come_on_a_little_more_effort` has 0 parameters but the declaration in trait `TooLittle::come_on_a_little_more_effort` has 3 | ||
--> $DIR/method-signature-matches.rs:47:5 | ||
| | ||
LL | fn come_on_a_little_more_effort(_: (), _: (), _: ()) -> impl Sized; | ||
| ---------------- trait requires 3 parameters | ||
... | ||
LL | fn come_on_a_little_more_effort() {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 3 parameters, found 0 | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0050`. |
Oops, something went wrong.