diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-01-16 14:35:37 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-01-17 19:47:48 +0100 |
| commit | 9c6c2f16f00ed6f24866d2d4927b49d79b453a23 (patch) | |
| tree | dde3a1cafa98dec96a82470f059a18d518770a05 | |
| parent | bf84eb538fd16743240434b3e837b36c35719fee (diff) | |
| download | rust-9c6c2f16f00ed6f24866d2d4927b49d79b453a23.tar.gz rust-9c6c2f16f00ed6f24866d2d4927b49d79b453a23.zip | |
Clean up E0198 explanation
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0198.md | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/librustc_error_codes/error_codes/E0198.md b/src/librustc_error_codes/error_codes/E0198.md index 6504d60dbd1..687214a2050 100644 --- a/src/librustc_error_codes/error_codes/E0198.md +++ b/src/librustc_error_codes/error_codes/E0198.md @@ -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) |
