Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
|
r? @tiif rustbot has assigned @tiif. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Could you add the issue number here and comment on what this test is about?
There was a problem hiding this comment.
Is the link enough?
| --> $DIR/defaults-specialization.rs:8:18 | ||
| | | ||
| LL | trait Tr { | ||
| ... |
There was a problem hiding this comment.
non-blocking style nit: will it be possible to have...?
LL | trait Tr {
| ...
There was a problem hiding this comment.
That change is something to bring up to rust-lang/annotate-snippets-rs. I don't think that rendering is necessarily ideal, because it would be hard to differentiate between the actual code being
trait Tr {
...and
trait Tr {
// this like will be skipped by the diagnostic renderer and replaced with ` ...`
By having it on the other side of the gutter, it makes that a bit clearer.
|
Reminder, once the PR becomes ready for a review, use |
This becomes particularly confusing when a type parameter has a default.
```
--> $DIR/default-type-parameter.rs:8:17
|
LL | fn foo() -> u32 { 0 }
| ^^^ expected `()`, found `u32`
|
note: type in trait
--> $DIR/default-type-parameter.rs:2:17
|
LL | fn foo() -> T;
| ^
= note: expected signature `fn() -> ()`
found signature `fn() -> u32`
note: expected to match this type parameter
--> $DIR/default-type-parameter.rs:1:13
|
LL | trait Trait<T = ()> {
| ^^^^^^
help: change the output type to match the trait
|
LL - fn foo() -> u32 { 0 }
LL + fn foo() -> () { 0 }
```
…the trait
```
error[E0053]: method `foo` has an incompatible type for trait
--> $DIR/async-example-desugared-boxed-in-trait.rs:11:28
|
LL | impl MyTrait for i32 {
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:7:22
|
LL | trait MyTrait {
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected signature `fn(&_) -> Pin<Box<dyn Future<Output = i32>>>`
found signature `fn(&_) -> impl Future<Output = i32>`
```
…type in trait" note
```
error[E0053]: method `foo` has an incompatible type for trait
--> $DIR/default-type-parameter.rs:8:17
|
LL | impl Trait for S {
LL | fn foo() -> u32 { 0 }
| ^^^ expected `()`, found `u32`
|
note: type in trait
--> $DIR/default-type-parameter.rs:2:17
|
LL | trait Trait<T = ()> {
| ------ expected to match the default of type parameter `T`
LL | fn foo() -> T;
| ^
= note: expected signature `fn() -> ()`
found signature `fn() -> u32`
help: change the output type to match the trait
|
LL - fn foo() -> u32 { 0 }
LL + fn foo() -> () { 0 }
|
```
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This becomes particularly confusing when a type parameter has a default.
Fix #67991.