]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/safety-trait-impl.stderr
Rollup merge of #103283 - nbarrios1337:unsafe-impl-suggestions, r=cjgillot
[rust.git] / src / test / ui / traits / safety-trait-impl.stderr
1 error[E0200]: the trait `UnsafeTrait` requires an `unsafe impl` declaration
2   --> $DIR/safety-trait-impl.rs:14:1
3    |
4 LL | impl UnsafeTrait for u16 { }
5    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |
7    = note: the trait `UnsafeTrait` enforces invariants that the compiler can't check. Review the trait documentation and make sure this implementation upholds those invariants before adding the `unsafe` keyword
8 help: add `unsafe` to this trait implementation
9    |
10 LL | unsafe impl UnsafeTrait for u16 { }
11    | ++++++
12
13 error[E0199]: implementing the trait `SafeTrait` is not unsafe
14   --> $DIR/safety-trait-impl.rs:16:1
15    |
16 LL | unsafe impl SafeTrait for u32 { }
17    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18    |
19 help: remove `unsafe` from this trait implementation
20    |
21 LL - unsafe impl SafeTrait for u32 { }
22 LL + impl SafeTrait for u32 { }
23    |
24
25 error: aborting due to 2 previous errors
26
27 Some errors have detailed explanations: E0199, E0200.
28 For more information about an error, try `rustc --explain E0199`.