Skip to content

Commit f81fba1

Browse files
committed
Report the range of uninit bytes in CTFE errors
1 parent f46ce66 commit f81fba1

36 files changed

+133
-46
lines changed

compiler/rustc_const_eval/src/interpret/validity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
397397
interp_ok(try_validation!(
398398
self.ecx.read_immediate(val),
399399
self.path,
400-
Ub(InvalidUninitBytes(None)) =>
400+
Ub(InvalidUninitBytes(_)) =>
401401
Uninit { expected },
402402
// The `Unsup` cases can only occur during CTFE
403403
Unsup(ReadPointerAsInt(_)) =>

compiler/rustc_middle/src/mir/interpret/allocation.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,11 @@ impl<Prov: Provenance, Extra, Bytes: AllocBytes> Allocation<Prov, Extra, Bytes>
700700
read_provenance: bool,
701701
) -> AllocResult<Scalar<Prov>> {
702702
// First and foremost, if anything is uninit, bail.
703-
if self.init_mask.is_range_initialized(range).is_err() {
704-
return Err(AllocError::InvalidUninitBytes(None));
703+
if let Err(bad) = self.init_mask.is_range_initialized(range) {
704+
return Err(AllocError::InvalidUninitBytes(Some(BadBytesAccess {
705+
access: range,
706+
bad,
707+
})));
705708
}
706709

707710
// Get the integer part of the result. We HAVE TO check provenance before returning this!

src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0x0..0x4], but memory is uninitialized at [0x0..0x4], and this operation requires initialized memory
22
--> tests/fail/function_calls/arg_inplace_observe_after.rs:LL:CC
33
|
44
LL | _observe = non_copy.0;
@@ -9,6 +9,11 @@ LL | _observe = non_copy.0;
99
= note: BACKTRACE:
1010
= note: inside `main` at tests/fail/function_calls/arg_inplace_observe_after.rs:LL:CC
1111

12+
Uninitialized memory occurred at ALLOC[0x0..0x4], in this allocation:
13+
ALLOC (stack variable, size: 4, align: 4) {
14+
__ __ __ __ │ ░░░░
15+
}
16+
1217
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1318

1419
error: aborting due to 1 previous error

src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.none.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0x0..0x4], but memory is uninitialized at [0x0..0x4], and this operation requires initialized memory
22
--> tests/fail/function_calls/arg_inplace_observe_during.rs:LL:CC
33
|
44
LL | unsafe { ptr.read() };
@@ -14,6 +14,11 @@ note: inside `main`
1414
LL | Call(_unit = change_arg(Move(*ptr), ptr), ReturnTo(after_call), UnwindContinue())
1515
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1616

17+
Uninitialized memory occurred at ALLOC[0x0..0x4], in this allocation:
18+
ALLOC (stack variable, size: 4, align: 4) {
19+
__ __ __ __ │ ░░░░
20+
}
21+
1722
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1823

1924
error: aborting due to 1 previous error

src/tools/miri/tests/fail/function_calls/return_pointer_aliasing_read.none.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0x0..0x4], but memory is uninitialized at [0x0..0x4], and this operation requires initialized memory
22
--> tests/fail/function_calls/return_pointer_aliasing_read.rs:LL:CC
33
|
44
LL | unsafe { ptr.read() };
@@ -14,6 +14,11 @@ note: inside `main`
1414
LL | Call(*ptr = myfun(ptr), ReturnTo(after_call), UnwindContinue())
1515
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1616

17+
Uninitialized memory occurred at ALLOC[0x0..0x4], in this allocation:
18+
ALLOC (stack variable, size: 4, align: 4) {
19+
__ __ __ __ │ ░░░░
20+
}
21+
1722
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1823

1924
error: aborting due to 1 previous error

src/tools/miri/tests/fail/function_calls/return_pointer_on_unwind.stderr

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ thread 'main' panicked at tests/fail/function_calls/return_pointer_on_unwind.rs:
33
explicit panic
44
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
55
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
6-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
6+
error: Undefined Behavior: reading memory at ALLOC[0x0..0x4], but memory is uninitialized at [0x0..0x4], and this operation requires initialized memory
77
--> tests/fail/function_calls/return_pointer_on_unwind.rs:LL:CC
88
|
99
LL | dbg!(x.0);
@@ -15,6 +15,19 @@ LL | dbg!(x.0);
1515
= note: inside `main` at RUSTLIB/std/src/macros.rs:LL:CC
1616
= note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info)
1717

18+
Uninitialized memory occurred at ALLOC[0x0..0x4], in this allocation:
19+
ALLOC (stack variable, size: 132, align: 4) {
20+
0x00 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
21+
0x10 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
22+
0x20 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
23+
0x30 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
24+
0x40 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
25+
0x50 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
26+
0x60 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
27+
0x70 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
28+
0x80 │ __ __ __ __ │ ░░░░
29+
}
30+
1831
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1932

2033
error: aborting due to 1 previous error

src/tools/miri/tests/fail/intrinsics/ptr_metadata_uninit_slice_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::intrinsics::mir::*;
99
pub unsafe fn deref_meta(p: *const *const [i32]) -> usize {
1010
mir! {
1111
{
12-
RET = PtrMetadata(*p); //~ ERROR: Undefined Behavior: using uninitialized data
12+
RET = PtrMetadata(*p); //~ ERROR: /Undefined Behavior: .*, but memory is uninitialized/
1313
Return()
1414
}
1515
}

src/tools/miri/tests/fail/intrinsics/ptr_metadata_uninit_slice_data.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0x0..0x8], but memory is uninitialized at [0x0..0x8], and this operation requires initialized memory
22
--> tests/fail/intrinsics/ptr_metadata_uninit_slice_data.rs:LL:CC
33
|
44
LL | RET = PtrMetadata(*p);
@@ -14,6 +14,11 @@ note: inside `main`
1414
LL | let _meta = deref_meta(p.as_ptr().cast());
1515
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1616

17+
Uninitialized memory occurred at ALLOC[0x0..0x8], in this allocation:
18+
ALLOC (stack variable, size: 16, align: 8) {
19+
__ __ __ __ __ __ __ __ 04 00 00 00 00 00 00 00 │ ░░░░░░░░........
20+
}
21+
1722
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1823

1924
error: aborting due to 1 previous error

src/tools/miri/tests/fail/intrinsics/ptr_metadata_uninit_slice_len.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::intrinsics::mir::*;
99
pub unsafe fn deref_meta(p: *const *const [i32]) -> usize {
1010
mir! {
1111
{
12-
RET = PtrMetadata(*p); //~ ERROR: Undefined Behavior: using uninitialized data
12+
RET = PtrMetadata(*p); //~ ERROR: /Undefined Behavior: .*, but memory is uninitialized/
1313
Return()
1414
}
1515
}

src/tools/miri/tests/fail/intrinsics/ptr_metadata_uninit_slice_len.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | (*p.as_mut_ptr().cast::<[*const i32; 2]>())[0] = 4 as *const i32;
1212
= note: BACKTRACE:
1313
= note: inside `main` at tests/fail/intrinsics/ptr_metadata_uninit_slice_len.rs:LL:CC
1414

15-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
15+
error: Undefined Behavior: reading memory at ALLOC[0x8..0x10], but memory is uninitialized at [0x8..0x10], and this operation requires initialized memory
1616
--> tests/fail/intrinsics/ptr_metadata_uninit_slice_len.rs:LL:CC
1717
|
1818
LL | RET = PtrMetadata(*p);
@@ -28,6 +28,11 @@ note: inside `main`
2828
LL | let _meta = deref_meta(p.as_ptr().cast());
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3030

31+
Uninitialized memory occurred at ALLOC[0x8..0x10], in this allocation:
32+
ALLOC (stack variable, size: 16, align: 8) {
33+
╾────0x4[wildcard]────╼ __ __ __ __ __ __ __ __ │ ╾──────╼░░░░░░░░
34+
}
35+
3136
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
3237

3338
error: aborting due to 1 previous error; 1 warning emitted

src/tools/miri/tests/fail/intrinsics/ptr_metadata_uninit_thin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::intrinsics::mir::*;
99
pub unsafe fn deref_meta(p: *const *const i32) -> () {
1010
mir! {
1111
{
12-
RET = PtrMetadata(*p); //~ ERROR: Undefined Behavior: using uninitialized data
12+
RET = PtrMetadata(*p); //~ ERROR: /Undefined Behavior: .*, but memory is uninitialized/
1313
Return()
1414
}
1515
}

src/tools/miri/tests/fail/intrinsics/ptr_metadata_uninit_thin.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0x0..0x8], but memory is uninitialized at [0x0..0x8], and this operation requires initialized memory
22
--> tests/fail/intrinsics/ptr_metadata_uninit_thin.rs:LL:CC
33
|
44
LL | RET = PtrMetadata(*p);
@@ -14,6 +14,11 @@ note: inside `main`
1414
LL | let _meta = deref_meta(p.as_ptr());
1515
| ^^^^^^^^^^^^^^^^^^^^^^
1616

17+
Uninitialized memory occurred at ALLOC[0x0..0x8], in this allocation:
18+
ALLOC (stack variable, size: 8, align: 8) {
19+
__ __ __ __ __ __ __ __ │ ░░░░░░░░
20+
}
21+
1722
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1823

1924
error: aborting due to 1 previous error

src/tools/miri/tests/fail/read_from_trivial_switch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ fn main() {
1010
let uninit: MaybeUninit<i32> = MaybeUninit::uninit();
1111
let bad_ref: &i32 = unsafe { uninit.assume_init_ref() };
1212
let &(0 | _) = bad_ref;
13-
//~^ ERROR: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
13+
//~^ ERROR: /Undefined Behavior: .*, but memory is uninitialized .* requires initialized memory/
1414
}

src/tools/miri/tests/fail/read_from_trivial_switch.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0x0..0x4], but memory is uninitialized at [0x0..0x4], and this operation requires initialized memory
22
--> tests/fail/read_from_trivial_switch.rs:LL:CC
33
|
44
LL | let &(0 | _) = bad_ref;
@@ -9,6 +9,11 @@ LL | let &(0 | _) = bad_ref;
99
= note: BACKTRACE:
1010
= note: inside `main` at tests/fail/read_from_trivial_switch.rs:LL:CC
1111

12+
Uninitialized memory occurred at ALLOC[0x0..0x4], in this allocation:
13+
ALLOC (stack variable, size: 4, align: 4) {
14+
__ __ __ __ │ ░░░░
15+
}
16+
1217
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1318

1419
error: aborting due to 1 previous error

src/tools/miri/tests/fail/uninit/padding-enum.stderr

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0x8..0x9], but memory is uninitialized at [0x8..0x9], and this operation requires initialized memory
22
--> tests/fail/uninit/padding-enum.rs:LL:CC
33
|
44
LL | let _val = *c.add(padding_offset);
@@ -9,6 +9,12 @@ LL | let _val = *c.add(padding_offset);
99
= note: BACKTRACE:
1010
= note: inside `main` at tests/fail/uninit/padding-enum.rs:LL:CC
1111

12+
Uninitialized memory occurred at ALLOC[0x8..0x9], in this allocation:
13+
ALLOC (stack variable, size: 24, align: 8) {
14+
0x00 │ 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░
15+
0x10 │ __ __ __ __ __ __ __ __ │ ░░░░░░░░
16+
}
17+
1218
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1319

1420
error: aborting due to 1 previous error

src/tools/miri/tests/fail/uninit/padding-pair.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0x9..0xa], but memory is uninitialized at [0x9..0xa], and this operation requires initialized memory
22
--> tests/fail/uninit/padding-pair.rs:LL:CC
33
|
44
LL | let v = unsafe { *z.offset(first_undef) };
@@ -9,6 +9,11 @@ LL | let v = unsafe { *z.offset(first_undef) };
99
= note: BACKTRACE:
1010
= note: inside `main` at tests/fail/uninit/padding-pair.rs:LL:CC
1111

12+
Uninitialized memory occurred at ALLOC[0x9..0xa], in this allocation:
13+
ALLOC (stack variable, size: 16, align: 8) {
14+
00 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ │ .........░░░░░░░
15+
}
16+
1217
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1318

1419
error: aborting due to 1 previous error

src/tools/miri/tests/fail/uninit/padding-struct.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0x1..0x2], but memory is uninitialized at [0x1..0x2], and this operation requires initialized memory
22
--> tests/fail/uninit/padding-struct.rs:LL:CC
33
|
44
LL | let _val = *c.add(1);
@@ -9,6 +9,11 @@ LL | let _val = *c.add(1);
99
= note: BACKTRACE:
1010
= note: inside `main` at tests/fail/uninit/padding-struct.rs:LL:CC
1111

12+
Uninitialized memory occurred at ALLOC[0x1..0x2], in this allocation:
13+
ALLOC (stack variable, size: 4, align: 2) {
14+
00 __ 00 00 │ .░..
15+
}
16+
1217
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1318

1419
error: aborting due to 1 previous error

src/tools/miri/tests/fail/uninit/padding-wide-ptr.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0x8..0x9], but memory is uninitialized at [0x8..0x9], and this operation requires initialized memory
22
--> tests/fail/uninit/padding-wide-ptr.rs:LL:CC
33
|
44
LL | let _val = *c.add(mem::size_of::<*const u8>());
@@ -9,6 +9,11 @@ LL | let _val = *c.add(mem::size_of::<*const u8>());
99
= note: BACKTRACE:
1010
= note: inside `main` at tests/fail/uninit/padding-wide-ptr.rs:LL:CC
1111

12+
Uninitialized memory occurred at ALLOC[0x8..0x9], in this allocation:
13+
ALLOC (stack variable, size: 16, align: 8) {
14+
00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░
15+
}
16+
1217
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1318

1419
error: aborting due to 1 previous error

src/tools/miri/tests/fail/uninit/transmute-pair-uninit.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0x9..0xa], but memory is uninitialized at [0x9..0xa], and this operation requires initialized memory
22
--> tests/fail/uninit/transmute-pair-uninit.rs:LL:CC
33
|
44
LL | let v = unsafe { *z.offset(first_undef) };
@@ -9,6 +9,11 @@ LL | let v = unsafe { *z.offset(first_undef) };
99
= note: BACKTRACE:
1010
= note: inside `main` at tests/fail/uninit/transmute-pair-uninit.rs:LL:CC
1111

12+
Uninitialized memory occurred at ALLOC[0x9..0xa], in this allocation:
13+
ALLOC (stack variable, size: 16, align: 8) {
14+
00 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ │ .........░░░░░░░
15+
}
16+
1217
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1318

1419
error: aborting due to 1 previous error

src/tools/miri/tests/fail/uninit/uninit_byte_read.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0x5..0x6], but memory is uninitialized at [0x5..0x6], and this operation requires initialized memory
22
--> tests/fail/uninit/uninit_byte_read.rs:LL:CC
33
|
44
LL | let undef = unsafe { *v.as_ptr().add(5) };
@@ -9,6 +9,11 @@ LL | let undef = unsafe { *v.as_ptr().add(5) };
99
= note: BACKTRACE:
1010
= note: inside `main` at tests/fail/uninit/uninit_byte_read.rs:LL:CC
1111

12+
Uninitialized memory occurred at ALLOC[0x5..0x6], in this allocation:
13+
ALLOC (Rust heap, size: 10, align: 1) {
14+
__ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░
15+
}
16+
1217
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1318

1419
error: aborting due to 1 previous error

src/tools/miri/tests/fail/validity/invalid_int_op.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0x0..0x4], but memory is uninitialized at [0x0..0x4], and this operation requires initialized memory
22
--> tests/fail/validity/invalid_int_op.rs:LL:CC
33
|
44
LL | let i = unsafe { std::mem::MaybeUninit::<i32>::uninit().assume_init() };
@@ -9,6 +9,11 @@ LL | let i = unsafe { std::mem::MaybeUninit::<i32>::uninit().assume_init() }
99
= note: BACKTRACE:
1010
= note: inside `main` at tests/fail/validity/invalid_int_op.rs:LL:CC
1111

12+
Uninitialized memory occurred at ALLOC[0x0..0x4], in this allocation:
13+
ALLOC (stack variable, size: 4, align: 4) {
14+
__ __ __ __ │ ░░░░
15+
}
16+
1217
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1318

1419
error: aborting due to 1 previous error

tests/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0080]: using uninitialized data, but this operation requires initialized memory
1+
error[E0080]: reading memory at ALLOC0[0x0..0x4], but memory is uninitialized at [0x1..0x4], and this operation requires initialized memory
22
--> $DIR/invalid-patterns.rs:40:32
33
|
44
LL | get_flag::<false, { unsafe { char_raw.character } }>();
@@ -26,7 +26,7 @@ LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character
2626
42 │ B
2727
}
2828

29-
error[E0080]: using uninitialized data, but this operation requires initialized memory
29+
error[E0080]: reading memory at ALLOC1[0x0..0x4], but memory is uninitialized at [0x1..0x4], and this operation requires initialized memory
3030
--> $DIR/invalid-patterns.rs:44:58
3131
|
3232
LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>();

tests/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0080]: using uninitialized data, but this operation requires initialized memory
1+
error[E0080]: reading memory at ALLOC0[0x0..0x4], but memory is uninitialized at [0x1..0x4], and this operation requires initialized memory
22
--> $DIR/invalid-patterns.rs:40:32
33
|
44
LL | get_flag::<false, { unsafe { char_raw.character } }>();
@@ -26,7 +26,7 @@ LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character
2626
42 │ B
2727
}
2828

29-
error[E0080]: using uninitialized data, but this operation requires initialized memory
29+
error[E0080]: reading memory at ALLOC1[0x0..0x4], but memory is uninitialized at [0x1..0x4], and this operation requires initialized memory
3030
--> $DIR/invalid-patterns.rs:44:58
3131
|
3232
LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>();

tests/ui/consts/const-err-enum-discriminant.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0080]: using uninitialized data, but this operation requires initialized memory
1+
error[E0080]: reading memory at ALLOC0[0x0..0x8], but memory is uninitialized at [0x0..0x8], and this operation requires initialized memory
22
--> $DIR/const-err-enum-discriminant.rs:8:21
33
|
44
LL | Boo = [unsafe { Foo { b: () }.a }; 4][3],

0 commit comments

Comments
 (0)