-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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 #105181 - bhbs:skip-note, r=estebank
Don't add a note for implementing a trait if its inner type is erroneous Fix #105138
- Loading branch information
Showing
3 changed files
with
64 additions
and
15 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
20 changes: 20 additions & 0 deletions
20
src/test/ui/trait-bounds/impl-bound-with-references-error.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,20 @@ | ||
// Regression test for #105138. | ||
// This test ensures that the compiler does not add note | ||
// for implementation of trait whose inner type is erroneous. | ||
|
||
pub enum LabelText { | ||
Plain, | ||
} | ||
|
||
impl<T> From<T> for LabelText | ||
//~^ ERROR conflicting implementations of trait `From<LabelText>` for type `LabelText` [E0119] | ||
where | ||
T: Into<Cow<'static, str>>, | ||
//~^ ERROR cannot find type `Cow` in this scope [E0412] | ||
{ | ||
fn from(text: T) -> Self { | ||
LabelText::Plain(text.into()) | ||
} | ||
} | ||
|
||
fn main() {} |
24 changes: 24 additions & 0 deletions
24
src/test/ui/trait-bounds/impl-bound-with-references-error.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,24 @@ | ||
error[E0412]: cannot find type `Cow` in this scope | ||
--> $DIR/impl-bound-with-references-error.rs:12:13 | ||
| | ||
LL | T: Into<Cow<'static, str>>, | ||
| ^^^ not found in this scope | ||
| | ||
help: consider importing this enum | ||
| | ||
LL | use std::borrow::Cow; | ||
| | ||
|
||
error[E0119]: conflicting implementations of trait `From<LabelText>` for type `LabelText` | ||
--> $DIR/impl-bound-with-references-error.rs:9:1 | ||
| | ||
LL | impl<T> From<T> for LabelText | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: conflicting implementation in crate `core`: | ||
- impl<T> From<T> for T; | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0119, E0412. | ||
For more information about an error, try `rustc --explain E0119`. |