fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `usize` 2 --> $DIR/lint-strict-provenance-lossy-casts.rs:6:23 3 | 4LL | let addr: usize = &x as *const u8 as usize; 5 | ^^^^^^^^^^^^^^^^^^^^^^^^ 6 | 7 = help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_addr()` instead 8note: the lint level is defined here 9 --> $DIR/lint-strict-provenance-lossy-casts.rs:2:9 10 | 11LL | #![deny(lossy_provenance_casts)] 12 | ^^^^^^^^^^^^^^^^^^^^^^ 13help: use `.addr()` to obtain the address of a pointer 14 | 15LL | let addr: usize = (&x as *const u8).addr(); 16 | + ~~~~~~~~ 17 18error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `u32` 19 --> $DIR/lint-strict-provenance-lossy-casts.rs:9:22 20 | 21LL | let addr_32bit = &x as *const u8 as u32; 22 | ^^^^^^^^^^^^^^^^^^^^^^ 23 | 24 = help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_addr()` instead 25help: use `.addr()` to obtain the address of a pointer 26 | 27LL | let addr_32bit = (&x as *const u8).addr() as u32; 28 | + ~~~~~~~~~~~~~~~ 29 30error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `usize` 31 --> $DIR/lint-strict-provenance-lossy-casts.rs:14:20 32 | 33LL | let ptr_addr = ptr as usize; 34 | ^^^--------- 35 | | 36 | help: use `.addr()` to obtain the address of a pointer: `.addr()` 37 | 38 = help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_addr()` instead 39 40error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `u32` 41 --> $DIR/lint-strict-provenance-lossy-casts.rs:16:26 42 | 43LL | let ptr_addr_32bit = ptr as u32; 44 | ^^^------- 45 | | 46 | help: use `.addr()` to obtain the address of a pointer: `.addr() as u32` 47 | 48 = help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_addr()` instead 49 50error: aborting due to 4 previous errors 51