From 23d1f1a5a3cccd4a0867833b4f0dc6e3ad5ad532 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 7 Jul 2022 20:12:30 -0400 Subject: [PATCH] rustup --- rust-version | 2 +- src/diagnostics.rs | 4 ++-- tests/fail/uninit_buffer.rs | 2 +- tests/fail/uninit_buffer.stderr | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rust-version b/rust-version index 37d1eb0fbde..53e7908f42c 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -8824d131619e58a38bde8bcf56401629b91a204a +1517f5de01c445b5124b30f02257b02b4c5ef3b2 diff --git a/src/diagnostics.rs b/src/diagnostics.rs index 289c46a5d2e..4dfa7bd07cb 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -291,8 +291,8 @@ pub fn report_error<'tcx, 'mir>( match e.kind() { UndefinedBehavior(UndefinedBehaviorInfo::InvalidUninitBytes(Some((alloc_id, access)))) => { eprintln!( - "Uninitialized read occurred at {alloc_id:?}{range:?}, in this allocation:", - range = alloc_range(access.uninit_offset, access.uninit_size), + "Uninitialized memory occurred at {alloc_id:?}{range:?}, in this allocation:", + range = access.uninit, ); eprintln!("{:?}", ecx.dump_alloc(*alloc_id)); } diff --git a/tests/fail/uninit_buffer.rs b/tests/fail/uninit_buffer.rs index 351181016e4..c8ebd835d36 100644 --- a/tests/fail/uninit_buffer.rs +++ b/tests/fail/uninit_buffer.rs @@ -1,4 +1,4 @@ -// error-pattern: 12 bytes are uninitialized +// error-pattern: memory is uninitialized at [0x4..0x10] use std::alloc::{alloc, dealloc, Layout}; use std::slice::from_raw_parts; diff --git a/tests/fail/uninit_buffer.stderr b/tests/fail/uninit_buffer.stderr index e8faf8dd8b9..879c827eb88 100644 --- a/tests/fail/uninit_buffer.stderr +++ b/tests/fail/uninit_buffer.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reading 16 bytes of memory starting at ALLOC, but 12 bytes are uninitialized starting at ALLOC+0x4, and this operation requires initialized memory +error: Undefined Behavior: reading memory at ALLOC[0x0..0x10], but memory is uninitialized at [0x4..0x10], and this operation requires initialized memory --> RUSTLIB/core/src/slice/cmp.rs:LL:CC | LL | let mut order = unsafe { memcmp(left.as_ptr(), right.as_ptr(), len) as isize }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading 16 bytes of memory starting at ALLOC, but 12 bytes are uninitialized starting at ALLOC+0x4, and this operation requires initialized memory + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at ALLOC[0x0..0x10], but memory is uninitialized at [0x4..0x10], and this operation requires initialized memory | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information @@ -17,7 +17,7 @@ LL | drop(slice1.cmp(slice2)); note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace -Uninitialized read occurred at ALLOC[0x4..0x10], in this allocation: +Uninitialized memory occurred at ALLOC[0x4..0x10], in this allocation: ALLOC (Rust heap, size: 32, align: 8) { 0x00 │ 41 42 43 44 __ __ __ __ __ __ __ __ __ __ __ __ │ ABCD░░░░░░░░░░░░ 0x10 │ 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ .░░░░░░░░░░░░░░░