]> git.lizzy.rs Git - rust.git/blob - src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr
Make some diagnostics not depend on the source of what they reference being available
[rust.git] / src / test / ui / dropck / dropck-eyepatch-implies-unsafe-impl.stderr
1 error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attribute
2   --> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:21:1
3    |
4 LL | / impl<#[may_dangle] A, B: fmt::Debug> Drop for Pt<A, B> {
5 LL | |
6 LL | |
7 LL | |     // (unsafe to access self.1  due to #[may_dangle] on A)
8 LL | |     fn drop(&mut self) { println!("drop {} {:?}", self.0, self.2); }
9 LL | | }
10    | |_^
11    |
12    = note: the trait `Drop` 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
13 help: add `unsafe` to this trait implementation
14    |
15 LL | unsafe impl<#[may_dangle] A, B: fmt::Debug> Drop for Pt<A, B> {
16    | ++++++
17
18 error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attribute
19   --> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:27:1
20    |
21 LL | / impl<#[may_dangle] 'a, 'b, B: fmt::Debug> Drop for Pr<'a, 'b, B> {
22 LL | |
23 LL | |
24 LL | |     // (unsafe to access self.1 due to #[may_dangle] on 'a)
25 LL | |     fn drop(&mut self) { println!("drop {} {:?}", self.0, self.2); }
26 LL | | }
27    | |_^
28    |
29    = note: the trait `Drop` 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
30 help: add `unsafe` to this trait implementation
31    |
32 LL | unsafe impl<#[may_dangle] 'a, 'b, B: fmt::Debug> Drop for Pr<'a, 'b, B> {
33    | ++++++
34
35 error: aborting due to 2 previous errors
36
37 For more information about this error, try `rustc --explain E0569`.