diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-01-15 13:37:01 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-01-16 13:54:58 +0100 |
| commit | 6f1bdb47f2a3bb24f60f8f27683991ddd2058b03 (patch) | |
| tree | 3ef863a88e486f5a078e0347213f88f18634e56c /src/librustc_error_codes/error_codes | |
| parent | a1a0aea9e3830f4351f45f3a56c1adbca49be481 (diff) | |
| download | rust-6f1bdb47f2a3bb24f60f8f27683991ddd2058b03.tar.gz rust-6f1bdb47f2a3bb24f60f8f27683991ddd2058b03.zip | |
clean up E0197 explanation
Diffstat (limited to 'src/librustc_error_codes/error_codes')
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0197.md | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/librustc_error_codes/error_codes/E0197.md b/src/librustc_error_codes/error_codes/E0197.md index 0d91157e572..c142b8f3664 100644 --- a/src/librustc_error_codes/error_codes/E0197.md +++ b/src/librustc_error_codes/error_codes/E0197.md @@ -1,13 +1,20 @@ +An inherent implementation was marked unsafe. + +Erroneous code example: + +```compile_fail,E0197 +struct Foo; + +unsafe impl Foo { } // error! +``` + Inherent implementations (one that do not implement a trait but provide methods associated with a type) are always safe because they are not implementing an unsafe trait. Removing the `unsafe` keyword from the inherent implementation will resolve this error. -```compile_fail,E0197 +``` struct Foo; -// this will cause this error -unsafe impl Foo { } -// converting it to this will fix it -impl Foo { } +impl Foo { } // ok! ``` |
