summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes/E0749.md
blob: dfe90ae89e4cb2a9837e60e7d50ff2dcc88e3dd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
An item was added on a negative impl.

Erroneous code example:

```compile_fail,E0749
# #![feature(negative_impls)]
trait MyTrait {
    type Foo;
}

impl !MyTrait for u32 {
    type Foo = i32; // error!
}
```

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 {}
```