-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #127783 - compiler-errors:rtn-pretty, r=fee1-dead
Put the dots back in RTN pretty printing Also don't render RTN-like bounds for methods with ty/const params.
- Loading branch information
Showing
5 changed files
with
114 additions
and
8 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
25 changes: 25 additions & 0 deletions
25
tests/ui/associated-type-bounds/return-type-notation/display.rs
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,25 @@ | ||
#![feature(return_type_notation)] | ||
//~^ WARN the feature `return_type_notation` is incomplete | ||
|
||
trait Trait {} | ||
fn needs_trait(_: impl Trait) {} | ||
|
||
trait Assoc { | ||
fn method() -> impl Sized; | ||
fn method_with_lt() -> impl Sized; | ||
fn method_with_ty<T>() -> impl Sized; | ||
fn method_with_ct<const N: usize>() -> impl Sized; | ||
} | ||
|
||
fn foo<T: Assoc>(t: T) { | ||
needs_trait(T::method()); | ||
//~^ ERROR the trait bound | ||
needs_trait(T::method_with_lt()); | ||
//~^ ERROR the trait bound | ||
needs_trait(T::method_with_ty()); | ||
//~^ ERROR the trait bound | ||
needs_trait(T::method_with_ct()); | ||
//~^ ERROR the trait bound | ||
} | ||
|
||
fn main() {} |
78 changes: 78 additions & 0 deletions
78
tests/ui/associated-type-bounds/return-type-notation/display.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,78 @@ | ||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/display.rs:1:12 | ||
| | ||
LL | #![feature(return_type_notation)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error[E0277]: the trait bound `impl Sized { <T as Assoc>::method(..) }: Trait` is not satisfied | ||
--> $DIR/display.rs:15:17 | ||
| | ||
LL | needs_trait(T::method()); | ||
| ----------- ^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized { <T as Assoc>::method(..) }` | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
note: required by a bound in `needs_trait` | ||
--> $DIR/display.rs:5:24 | ||
| | ||
LL | fn needs_trait(_: impl Trait) {} | ||
| ^^^^^ required by this bound in `needs_trait` | ||
|
||
error[E0277]: the trait bound `impl Sized { <T as Assoc>::method_with_lt(..) }: Trait` is not satisfied | ||
--> $DIR/display.rs:17:17 | ||
| | ||
LL | needs_trait(T::method_with_lt()); | ||
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized { <T as Assoc>::method_with_lt(..) }` | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
note: required by a bound in `needs_trait` | ||
--> $DIR/display.rs:5:24 | ||
| | ||
LL | fn needs_trait(_: impl Trait) {} | ||
| ^^^^^ required by this bound in `needs_trait` | ||
|
||
error[E0277]: the trait bound `impl Sized: Trait` is not satisfied | ||
--> $DIR/display.rs:19:17 | ||
| | ||
LL | needs_trait(T::method_with_ty()); | ||
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized` | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
help: this trait has no implementations, consider adding one | ||
--> $DIR/display.rs:4:1 | ||
| | ||
LL | trait Trait {} | ||
| ^^^^^^^^^^^ | ||
note: required by a bound in `needs_trait` | ||
--> $DIR/display.rs:5:24 | ||
| | ||
LL | fn needs_trait(_: impl Trait) {} | ||
| ^^^^^ required by this bound in `needs_trait` | ||
|
||
error[E0277]: the trait bound `impl Sized: Trait` is not satisfied | ||
--> $DIR/display.rs:21:17 | ||
| | ||
LL | needs_trait(T::method_with_ct()); | ||
| ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized` | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
help: this trait has no implementations, consider adding one | ||
--> $DIR/display.rs:4:1 | ||
| | ||
LL | trait Trait {} | ||
| ^^^^^^^^^^^ | ||
note: required by a bound in `needs_trait` | ||
--> $DIR/display.rs:5:24 | ||
| | ||
LL | fn needs_trait(_: impl Trait) {} | ||
| ^^^^^ required by this bound in `needs_trait` | ||
|
||
error: aborting due to 4 previous errors; 1 warning emitted | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
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