fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.6 KiB27 linesraw
1error: Undefined Behavior: reading memory at ALLOC[0x0..0x10], but memory is uninitialized at [0x4..0x10], and this operation requires initialized memory
2  --> RUSTLIB/core/src/slice/cmp.rs:LL:CC
3   |
4LL |         let mut order = unsafe { compare_bytes(left.as_ptr(), right.as_ptr(), len) as isize };
5   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at ALLOC[0x0..0x10], but memory is uninitialized at [0x4..0x10], and this operation requires initialized memory
6   |
7   = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
8   = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
9   = note: BACKTRACE:
10   = note: inside `<u8 as core::slice::cmp::SliceOrd>::compare` at RUSTLIB/core/src/slice/cmp.rs:LL:CC
11   = note: inside `core::slice::cmp::<impl std::cmp::Ord for [u8]>::cmp` at RUSTLIB/core/src/slice/cmp.rs:LL:CC
12note: inside `main`
13  --> $DIR/uninit_buffer.rs:LL:CC
14   |
15LL |         drop(slice1.cmp(slice2));
16   |              ^^^^^^^^^^^^^^^^^^
17
18note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
19
20Uninitialized memory occurred at ALLOC[0x4..0x10], in this allocation:
21ALLOC (Rust heap, size: 32, align: 8) {
22    0x00 │ 41 42 43 44 __ __ __ __ __ __ __ __ __ __ __ __ │ ABCD░░░░░░░░░░░░
23    0x10 │ 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ .░░░░░░░░░░░░░░░
24}
25
26error: aborting due to previous error
27