Clean up E0198 explanation
This commit is contained in:
parent
bf84eb538f
commit
9c6c2f16f0
1 changed files with 10 additions and 9 deletions
|
@ -1,17 +1,18 @@
|
|||
A negative implementation was marked as unsafe.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail
|
||||
struct Foo;
|
||||
|
||||
unsafe impl !Clone for Foo { } // error!
|
||||
```
|
||||
|
||||
A negative implementation is one that excludes a type from implementing a
|
||||
particular trait. Not being able to use a trait is always a safe operation,
|
||||
so negative implementations are always safe and never need to be marked as
|
||||
unsafe.
|
||||
|
||||
```compile_fail
|
||||
#![feature(optin_builtin_traits)]
|
||||
|
||||
struct Foo;
|
||||
|
||||
// unsafe is unnecessary
|
||||
unsafe impl !Clone for Foo { }
|
||||
```
|
||||
|
||||
This will compile:
|
||||
|
||||
```ignore (ignore auto_trait future compatibility warning)
|
||||
|
|
Loading…
Add table
Reference in a new issue