diff options
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0749.md')
-rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0749.md | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0749.md b/compiler/rustc_error_codes/src/error_codes/E0749.md new file mode 100644 index 000000000..dfe90ae89 --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0749.md @@ -0,0 +1,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 {} +``` |