Given:
trait Logic {}
impl Logic for bool {}
impl<I, T> Logic for I
where
I: IntoIterator<Item = T>,
T: Logic,
{}
yields:
error[E0119]: conflicting implementations of trait `Logic` for type `bool`
--> src/lib.rs:5:1
|
3 | impl Logic for bool {}
| ------------------- first implementation here
4 |
5 | / impl<I, T> Logic for I
6 | | where
7 | | I: IntoIterator<Item = T>,
8 | | T: Logic,
| |_____________^ conflicting implementation for `bool`
|
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `bool` in future versions
For more information about this error, try `rustc --explain E0119`.
I don't get why though. I get the argument that theoretically there could be an Iterator impl for bool in future versions of std.
However, then it'd need to yield elements implementing Logic, which it can't since Logic is from my crate (otherwise there would need to be a circular dependency between my crate <-> std)? So why the error?
A browser interface to the Rust compiler to experiment with the language