-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Given the following code:
struct S;
impl From<()> for S {
fn from(x: ()) -> Self {
S
}
}
impl<I> From<I> for S
where
I: Iterator<Item = ()>,
{
fn from(x: I) -> Self {
S
}
}
fn main() {}
The current output is:
error[E0119]: conflicting implementations of trait `std::convert::From<()>` for type `S`
--> foo.rs:9:1
|
3 | impl From<()> for S {
| ------------------- first implementation here
...
9 | / impl<I> From<I> for S
10 | | where
11 | | I: Iterator<Item = ()>,
12 | | {
... |
15 | | }
16 | | }
| |_^ conflicting implementation for `S`
|
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
error: aborting due to previous error
For more information about this error, try `rustc --explain E0119`.
Ideally the output should look like:
error[E0119]: conflicting implementations of trait `std::convert::From<()>` for type `S`
--> foo.rs:9:1
|
3 | impl From<()> for S {
| ------------------- first implementation here
...
9 | / impl<I> From<I> for S
10 | | where
11 | | I: Iterator<Item = ()>,
12 | | {
... |
15 | | }
16 | | }
| |_^ conflicting implementation for `S`
|
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
error: aborting due to previous error
For more information about this error, try `rustc --explain E0119`.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.