summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes/E0197.md
blob: c142b8f3664c5e83a46c396d7191681c1298f79f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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.

```
struct Foo;

impl Foo { } // ok!
```