Closed
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`.