|
| 1 | +warning: integer-to-pointer cast |
| 2 | + --> $DIR/ptr_metadata_uninit_slice_len.rs:LL:CC |
| 3 | + | |
| 4 | +LL | (*p.as_mut_ptr().cast::<[*const i32; 2]>())[0] = 4 as *const i32; |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ integer-to-pointer cast |
| 6 | + | |
| 7 | + = help: This program is using integer-to-pointer casts or (equivalently) `ptr::with_exposed_provenance`, |
| 8 | + = help: which means that Miri might miss pointer bugs in this program. |
| 9 | + = help: See https://doc.rust-lang.org/nightly/std/ptr/fn.with_exposed_provenance.html for more details on that operation. |
| 10 | + = help: To ensure that Miri does not miss bugs in your program, use Strict Provenance APIs (https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance, https://crates.io/crates/sptr) instead. |
| 11 | + = help: You can then pass the `-Zmiri-strict-provenance` flag to Miri, to ensure you are not relying on `with_exposed_provenance` semantics. |
| 12 | + = help: Alternatively, the `-Zmiri-permissive-provenance` flag disables this warning. |
| 13 | + = note: BACKTRACE: |
| 14 | + = note: inside `main` at $DIR/ptr_metadata_uninit_slice_len.rs:LL:CC |
| 15 | + |
| 16 | +error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory |
| 17 | + --> $DIR/ptr_metadata_uninit_slice_len.rs:LL:CC |
| 18 | + | |
| 19 | +LL | RET = PtrMetadata(*p); |
| 20 | + | ^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory |
| 21 | + | |
| 22 | + = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior |
| 23 | + = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information |
| 24 | + = note: BACKTRACE: |
| 25 | + = note: inside `deref_meta` at $DIR/ptr_metadata_uninit_slice_len.rs:LL:CC |
| 26 | +note: inside `main` |
| 27 | + --> $DIR/ptr_metadata_uninit_slice_len.rs:LL:CC |
| 28 | + | |
| 29 | +LL | let _meta = deref_meta(p.as_ptr().cast()); |
| 30 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 31 | + |
| 32 | +note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace |
| 33 | + |
| 34 | +error: aborting due to 1 previous error; 1 warning emitted |
| 35 | + |
0 commit comments