Skip to content

Commit 5320028

Browse files
authored
Rollup merge of #75360 - pickfire:patch-4, r=GuillaumeGomez
Add sample fix for E0749 Even though the description is clear but the solution may not be as straightforward. Adding a suggested fix from documentation side. r? @GuillaumeGomez However, this suggestion should be shown in rustc itself for easy fix, the documentation should also reflect on the changes in rustc. Currently, ``` error[E0749]: negative impls cannot have any items --> test.rs:6:5 | 6 | type Foo = i32; // error! | ^^^^^^^^^^^^^^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0749`. ``` rustc should tell the user to remove it.
2 parents ca462d3 + a7f61bf commit 5320028

File tree

1 file changed

+11
-1
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+11
-1
lines changed

src/librustc_error_codes/error_codes/E0749.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,19 @@ trait MyTrait {
1111
impl !MyTrait for u32 {
1212
type Foo = i32; // error!
1313
}
14-
# fn main() {}
1514
```
1615

1716
Negative impls are not allowed to have any items. Negative impls declare that a
1817
trait is **not** implemented (and never will be) and hence there is no need to
1918
specify the values for trait methods or other items.
19+
20+
One way to fix this is to remove the items in negative impls:
21+
22+
```
23+
# #![feature(negative_impls)]
24+
trait MyTrait {
25+
type Foo;
26+
}
27+
28+
impl !MyTrait for u32 {}
29+
```

0 commit comments

Comments
 (0)