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 authored Jan 18, 2020
2 parents 7f6fdef + 9c6c2f1 commit 2a1ab29
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 2a1ab29

Please sign in to comment.