about summary refs log tree commit diff
path: root/tests/ui/lint/int_to_ptr-unsized.stderr
blob: 9799af8b12c15be33dacd47993555b46696fb786 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
warning: transmuting an integer to a pointer creates a pointer without provenance
  --> $DIR/int_to_ptr-unsized.rs:17:25
   |
LL |     let _ref = unsafe { std::mem::transmute::<usizemetadata, &'static str>(0xff) };
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this is dangerous because dereferencing the resulting pointer is undefined behavior
   = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
   = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
   = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
   = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>
   = note: `#[warn(integer_to_ptr_transmutes)]` on by default

warning: transmuting an integer to a pointer creates a pointer without provenance
  --> $DIR/int_to_ptr-unsized.rs:19:25
   |
LL |     let _ptr = unsafe { std::mem::transmute::<usizemetadata, *const [u8]>(0xff) };
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this is dangerous because dereferencing the resulting pointer is undefined behavior
   = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance
   = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`
   = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>
   = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>

warning: 2 warnings emitted