]> git.proxmox.com Git - rustc.git/blob - src/librustc_error_codes/error_codes/E0199.md
New upstream version 1.42.0+dfsg1
[rustc.git] / src / librustc_error_codes / error_codes / E0199.md
1 A trait implementation was marked as unsafe while the trait is safe.
2
3 Erroneous code example:
4
5 ```compile_fail,E0199
6 struct Foo;
7
8 trait Bar { }
9
10 unsafe impl Bar for Foo { } // error!
11 ```
12
13 Safe traits should not have unsafe implementations, therefore marking an
14 implementation for a safe trait unsafe will cause a compiler error. Removing
15 the unsafe marker on the trait noted in the error will resolve this problem:
16
17 ```
18 struct Foo;
19
20 trait Bar { }
21
22 impl Bar for Foo { } // ok!
23 ```