]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0197.md
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0197.md
1 An inherent implementation was marked unsafe.
2
3 Erroneous code example:
4
5 ```compile_fail,E0197
6 struct Foo;
7
8 unsafe impl Foo { } // error!
9 ```
10
11 Inherent implementations (one that do not implement a trait but provide
12 methods associated with a type) are always safe because they are not
13 implementing an unsafe trait. Removing the `unsafe` keyword from the inherent
14 implementation will resolve this error.
15
16 ```
17 struct Foo;
18
19 impl Foo { } // ok!
20 ```