|
| 1 | +warning: creating an intermediate reference implies aliasing requirements even when immediately cast to a raw pointers |
| 2 | + --> $DIR/lint-raw-borrows-via-references.rs:14:14 |
| 3 | + | |
| 4 | +LL | unsafe { &(*x).0 as *const i32 } |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^ |
| 6 | + | |
| 7 | +note: the lint level is defined here |
| 8 | + --> $DIR/lint-raw-borrows-via-references.rs:6:9 |
| 9 | + | |
| 10 | +LL | #![warn(raw_borrows_via_references)] |
| 11 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 12 | +help: consider using `&raw const` for a safer and more explicit raw pointer |
| 13 | + | |
| 14 | +LL - unsafe { &(*x).0 as *const i32 } |
| 15 | +LL + unsafe { &raw const (*x).0 } |
| 16 | + | |
| 17 | + |
| 18 | +warning: creating an intermediate reference implies aliasing requirements even when immediately cast to a raw pointers |
| 19 | + --> $DIR/lint-raw-borrows-via-references.rs:19:14 |
| 20 | + | |
| 21 | +LL | unsafe { &(*x).b as *const u8 } |
| 22 | + | ^^^^^^^^^^^^^^^^^^^^ |
| 23 | + | |
| 24 | +help: consider using `&raw const` for a safer and more explicit raw pointer |
| 25 | + | |
| 26 | +LL - unsafe { &(*x).b as *const u8 } |
| 27 | +LL + unsafe { &raw const (*x).b } |
| 28 | + | |
| 29 | + |
| 30 | +warning: creating an intermediate reference implies aliasing requirements even when immediately cast to a raw pointers |
| 31 | + --> $DIR/lint-raw-borrows-via-references.rs:24:14 |
| 32 | + | |
| 33 | +LL | unsafe { &mut (*x).0 as *mut i32 } |
| 34 | + | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 35 | + | |
| 36 | +help: consider using `&raw mut` for a safer and more explicit raw pointer |
| 37 | + | |
| 38 | +LL - unsafe { &mut (*x).0 as *mut i32 } |
| 39 | +LL + unsafe { &raw mut (*x).0 } |
| 40 | + | |
| 41 | + |
| 42 | +warning: creating an intermediate reference implies aliasing requirements even when immediately cast to a raw pointers |
| 43 | + --> $DIR/lint-raw-borrows-via-references.rs:29:14 |
| 44 | + | |
| 45 | +LL | unsafe { &mut (*x).a as *mut i32 } |
| 46 | + | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 47 | + | |
| 48 | +help: consider using `&raw mut` for a safer and more explicit raw pointer |
| 49 | + | |
| 50 | +LL - unsafe { &mut (*x).a as *mut i32 } |
| 51 | +LL + unsafe { &raw mut (*x).a } |
| 52 | + | |
| 53 | + |
| 54 | +warning: creating an intermediate reference implies aliasing requirements even when immediately cast to a raw pointers |
| 55 | + --> $DIR/lint-raw-borrows-via-references.rs:34:14 |
| 56 | + | |
| 57 | +LL | unsafe { &(*x).0 as *const i32 as *const u8 } |
| 58 | + | ^^^^^^^^^^^^^^^^^^^^^ |
| 59 | + | |
| 60 | +help: consider using `&raw const` for a safer and more explicit raw pointer |
| 61 | + | |
| 62 | +LL - unsafe { &(*x).0 as *const i32 as *const u8 } |
| 63 | +LL + unsafe { &raw const (*x).0 as *const u8 } |
| 64 | + | |
| 65 | + |
| 66 | +warning: creating an intermediate reference implies aliasing requirements even when immediately cast to a raw pointers |
| 67 | + --> $DIR/lint-raw-borrows-via-references.rs:54:15 |
| 68 | + | |
| 69 | +LL | let _ = { &x as *const i32 }; |
| 70 | + | ^^^^^^^^^^^^^^^^ |
| 71 | + | |
| 72 | +help: consider using `&raw const` for a safer and more explicit raw pointer |
| 73 | + | |
| 74 | +LL - let _ = { &x as *const i32 }; |
| 75 | +LL + let _ = { &raw const x }; |
| 76 | + | |
| 77 | + |
| 78 | +warning: creating an intermediate reference implies aliasing requirements even when immediately cast to a raw pointers |
| 79 | + --> $DIR/lint-raw-borrows-via-references.rs:59:11 |
| 80 | + | |
| 81 | +LL | { &y as *const i32 } |
| 82 | + | ^^^^^^^^^^^^^^^^ |
| 83 | + | |
| 84 | +help: consider using `&raw const` for a safer and more explicit raw pointer |
| 85 | + | |
| 86 | +LL - { &y as *const i32 } |
| 87 | +LL + { &raw const y } |
| 88 | + | |
| 89 | + |
| 90 | +warning: creating an intermediate reference implies aliasing requirements even when immediately cast to a raw pointers |
| 91 | + --> $DIR/lint-raw-borrows-via-references.rs:68:10 |
| 92 | + | |
| 93 | +LL | &$e as *const i32 |
| 94 | + | ^^^^^^^^^^^^^^^^ |
| 95 | +... |
| 96 | +LL | unsafe { ref_cast!(*x) } |
| 97 | + | ------------- in this macro invocation |
| 98 | + | |
| 99 | + = help: consider using `&raw const` for a safer and more explicit raw pointer |
| 100 | + = note: this warning originates in the macro `ref_cast` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 101 | + |
| 102 | +warning: creating an intermediate reference implies aliasing requirements even when immediately cast to a raw pointers |
| 103 | + --> $DIR/lint-raw-borrows-via-references.rs:79:13 |
| 104 | + | |
| 105 | +LL | let a = &a as *const i32; |
| 106 | + | ^^^^^^^^^^^^^^^^ |
| 107 | + | |
| 108 | +help: consider using `&raw const` for a safer and more explicit raw pointer |
| 109 | + | |
| 110 | +LL - let a = &a as *const i32; |
| 111 | +LL + let a = &raw const a; |
| 112 | + | |
| 113 | + |
| 114 | +warning: creating an intermediate reference implies aliasing requirements even when immediately cast to a raw pointers |
| 115 | + --> $DIR/lint-raw-borrows-via-references.rs:83:13 |
| 116 | + | |
| 117 | +LL | let b = &mut b as *mut i32; |
| 118 | + | ^^^^^^^^^^^^^^^^^^ |
| 119 | + | |
| 120 | +help: consider using `&raw mut` for a safer and more explicit raw pointer |
| 121 | + | |
| 122 | +LL - let b = &mut b as *mut i32; |
| 123 | +LL + let b = &raw mut b; |
| 124 | + | |
| 125 | + |
| 126 | +warning: 10 warnings emitted |
| 127 | + |
0 commit comments