Split fix into another section for E0749

This commit is contained in:
Ivan Tham 2020-08-10 22:33:17 +08:00 committed by GitHub
parent ec23f4ed3f
commit a2d7c33aa8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,10 +11,20 @@ trait MyTrait {
impl !MyTrait for u32 {
type Foo = i32; // error!
}
// impl !MyTrait for u32 {} // fix
# fn main() {}
```
Negative impls are not allowed to have any items. Negative impls declare that a
trait is **not** implemented (and never will be) and hence there is no need to
specify the values for trait methods or other items.
One way to fix this is to remove the items in negative impls.
```
# #![feature(negative_impls)]
trait MyTrait {
type Foo;
}
impl !MyTrait for u32 {}
```