Skip to content

Commit

Permalink
Clean up E0198 explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jan 17, 2020
1 parent bf84eb5 commit 9c6c2f1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/librustc_error_codes/error_codes/E0198.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
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.
A negative implementation was marked as unsafe.

```compile_fail
#![feature(optin_builtin_traits)]
Erroneous code example:

```compile_fail
struct Foo;
// unsafe is unnecessary
unsafe impl !Clone for 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.

This will compile:

```ignore (ignore auto_trait future compatibility warning)
Expand Down

0 comments on commit 9c6c2f1

Please sign in to comment.