Open
Description
The following code fails to compile:
trait Foo {}
auto trait FooAuto {}
impl<T> !FooAuto for T where T: Foo {}
fn test<T>(t: T) where T: FooAuto {}
fn main() {
test(1i32);
}
It produces the following error.
error[E0277]: the trait bound `i32: FooAuto` is not satisfied
--> src/main.rs:11:5
|
10 | test(1i32);
| ^^^^ the trait `FooAuto` is not implemented for `i32`
|
= note: required by `test`
(Playpen)
Even though I restrict the !FooAuto
implementation to types implementing Foo
(which there is none of), the rust compiler does not seem to take that restriction into account. Instead, it removes the FooAuto
auto-implementation from every type.
If I remove the !FooAuto
line, the code compiles just fine.
The same problems happens when I use impl<T: Foo>
instead of where T: Foo
(Playpen).
Also using impl FooAuto for .. {}
instead of auto trait FooAuto
results in the same problem (Playpen).