Skip to content

Commit

Permalink
Rollup merge of rust-lang#68279 - GuillaumeGomez:clean-up-e0198, r=Dy…
Browse files Browse the repository at this point in the history
…lan-DPC

Clean up E0198 explanation

r? @Dylan-DPC
  • Loading branch information
tmandry committed Jan 17, 2020
2 parents 7f44666 + 9c6c2f1 commit fe413c7
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 fe413c7

Please sign in to comment.