-
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.
Report the
note
when specified in diagnostic::on_unimplemented
Signed-off-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
- Loading branch information
1 parent
adf8d16
commit 5168584
Showing
8 changed files
with
109 additions
and
47 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
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,19 @@ | ||
#[diagnostic::on_unimplemented(message = "my message", label = "my label", note = "my note")] | ||
pub trait ProviderLt {} | ||
|
||
pub trait ProviderExt { | ||
fn request<R>(&self) { | ||
todo!() | ||
} | ||
} | ||
|
||
impl<T: ?Sized + ProviderLt> ProviderExt for T {} | ||
|
||
struct B; | ||
|
||
fn main() { | ||
B.request(); | ||
} | ||
//~^^ my message [E0599] | ||
//~| my label | ||
//~| my note |
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,32 @@ | ||
error[E0599]: my message | ||
--> $DIR/custom-on-unimplemented-diagnostic.rs:15:7 | ||
| | ||
LL | struct B; | ||
| -------- method `request` not found for this struct because it doesn't satisfy `B: ProviderExt` or `B: ProviderLt` | ||
... | ||
LL | B.request(); | ||
| ^^^^^^^ my label | ||
| | ||
note: trait bound `B: ProviderLt` was not satisfied | ||
--> $DIR/custom-on-unimplemented-diagnostic.rs:10:18 | ||
| | ||
LL | impl<T: ?Sized + ProviderLt> ProviderExt for T {} | ||
| ^^^^^^^^^^ ----------- - | ||
| | | ||
| unsatisfied trait bound introduced here | ||
= note: my note | ||
note: the trait `ProviderLt` must be implemented | ||
--> $DIR/custom-on-unimplemented-diagnostic.rs:2:1 | ||
| | ||
LL | pub trait ProviderLt {} | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
= help: items from traits can only be used if the trait is implemented and in scope | ||
note: `ProviderExt` defines an item `request`, perhaps you need to implement it | ||
--> $DIR/custom-on-unimplemented-diagnostic.rs:4:1 | ||
| | ||
LL | pub trait ProviderExt { | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0599`. |
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,15 @@ | ||
pub trait ProviderLt {} | ||
|
||
pub trait ProviderExt { | ||
fn request<R>(&self) { | ||
todo!() | ||
} | ||
} | ||
|
||
impl<T: ?Sized + ProviderLt> ProviderExt for T {} | ||
|
||
struct B; | ||
|
||
fn main() { | ||
B.request(); //~ ERROR 14:7: 14:14: the method `request` exists for struct `B`, but its trait bounds were not satisfied [E0599] | ||
} |
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,31 @@ | ||
error[E0599]: the method `request` exists for struct `B`, but its trait bounds were not satisfied | ||
--> $DIR/on-unimplemented-diagnostic.rs:14:7 | ||
| | ||
LL | struct B; | ||
| -------- method `request` not found for this struct because it doesn't satisfy `B: ProviderExt` or `B: ProviderLt` | ||
... | ||
LL | B.request(); | ||
| ^^^^^^^ method cannot be called on `B` due to unsatisfied trait bounds | ||
| | ||
note: trait bound `B: ProviderLt` was not satisfied | ||
--> $DIR/on-unimplemented-diagnostic.rs:9:18 | ||
| | ||
LL | impl<T: ?Sized + ProviderLt> ProviderExt for T {} | ||
| ^^^^^^^^^^ ----------- - | ||
| | | ||
| unsatisfied trait bound introduced here | ||
note: the trait `ProviderLt` must be implemented | ||
--> $DIR/on-unimplemented-diagnostic.rs:1:1 | ||
| | ||
LL | pub trait ProviderLt {} | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
= help: items from traits can only be used if the trait is implemented and in scope | ||
note: `ProviderExt` defines an item `request`, perhaps you need to implement it | ||
--> $DIR/on-unimplemented-diagnostic.rs:3:1 | ||
| | ||
LL | pub trait ProviderExt { | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0599`. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.