|
| 1 | +warning: creating a intermediate reference implies aliasing requirements even when immediately casting to raw pointers |
| 2 | + --> $DIR/lint-unnecessary-refs.rs:12:14 |
| 3 | + | |
| 4 | +LL | unsafe { &(*x).0 as *const i32 } |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^ |
| 6 | + | |
| 7 | + = note: `#[warn(unnecessary_refs)]` on by default |
| 8 | +help: consider using `&raw const` for a safer and more explicit raw pointer |
| 9 | + | |
| 10 | +LL - unsafe { &(*x).0 as *const i32 } |
| 11 | +LL + unsafe { &raw const (*x).0 } |
| 12 | + | |
| 13 | + |
| 14 | +warning: creating a intermediate reference implies aliasing requirements even when immediately casting to raw pointers |
| 15 | + --> $DIR/lint-unnecessary-refs.rs:17:14 |
| 16 | + | |
| 17 | +LL | unsafe { &(*x).b as *const u8 } |
| 18 | + | ^^^^^^^^^^^^^^^^^^^^ |
| 19 | + | |
| 20 | +help: consider using `&raw const` for a safer and more explicit raw pointer |
| 21 | + | |
| 22 | +LL - unsafe { &(*x).b as *const u8 } |
| 23 | +LL + unsafe { &raw const (*x).b } |
| 24 | + | |
| 25 | + |
| 26 | +warning: creating a intermediate reference implies aliasing requirements even when immediately casting to raw pointers |
| 27 | + --> $DIR/lint-unnecessary-refs.rs:22:14 |
| 28 | + | |
| 29 | +LL | unsafe { &mut (*x).0 as *mut i32 } |
| 30 | + | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 31 | + | |
| 32 | +help: consider using `&raw mut` for a safer and more explicit raw pointer |
| 33 | + | |
| 34 | +LL - unsafe { &mut (*x).0 as *mut i32 } |
| 35 | +LL + unsafe { &raw mut (*x).0 } |
| 36 | + | |
| 37 | + |
| 38 | +warning: creating a intermediate reference implies aliasing requirements even when immediately casting to raw pointers |
| 39 | + --> $DIR/lint-unnecessary-refs.rs:27:14 |
| 40 | + | |
| 41 | +LL | unsafe { &mut (*x).a as *mut i32 } |
| 42 | + | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 43 | + | |
| 44 | +help: consider using `&raw mut` for a safer and more explicit raw pointer |
| 45 | + | |
| 46 | +LL - unsafe { &mut (*x).a as *mut i32 } |
| 47 | +LL + unsafe { &raw mut (*x).a } |
| 48 | + | |
| 49 | + |
| 50 | +warning: creating a intermediate reference implies aliasing requirements even when immediately casting to raw pointers |
| 51 | + --> $DIR/lint-unnecessary-refs.rs:33:13 |
| 52 | + | |
| 53 | +LL | let a = &a as *const i32; |
| 54 | + | ^^^^^^^^^^^^^^^^ |
| 55 | + | |
| 56 | +help: consider using `&raw const` for a safer and more explicit raw pointer |
| 57 | + | |
| 58 | +LL - let a = &a as *const i32; |
| 59 | +LL + let a = &raw const a; |
| 60 | + | |
| 61 | + |
| 62 | +warning: creating a intermediate reference implies aliasing requirements even when immediately casting to raw pointers |
| 63 | + --> $DIR/lint-unnecessary-refs.rs:37:13 |
| 64 | + | |
| 65 | +LL | let b = &mut b as *mut i32; |
| 66 | + | ^^^^^^^^^^^^^^^^^^ |
| 67 | + | |
| 68 | +help: consider using `&raw mut` for a safer and more explicit raw pointer |
| 69 | + | |
| 70 | +LL - let b = &mut b as *mut i32; |
| 71 | +LL + let b = &raw mut b; |
| 72 | + | |
| 73 | + |
| 74 | +warning: 6 warnings emitted |
| 75 | + |
0 commit comments