Skip to content

Commit 60fe8c0

Browse files
author
The Miri Conjob Bot
committed
Merge from rustc
2 parents 53540ed + d047247 commit 60fe8c0

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

src/diagnostics.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ pub fn report_error<'tcx, 'mir>(
273273
} else {
274274
#[rustfmt::skip]
275275
let title = match e.kind() {
276+
UndefinedBehavior(UndefinedBehaviorInfo::ValidationError(e)) if matches!(e.kind, ValidationErrorKind::PointerAsInt { .. } | ValidationErrorKind::PartialPointer) =>
277+
bug!("This validation error should be impossible in Miri: {:?}", e.kind),
276278
UndefinedBehavior(_) =>
277279
"Undefined Behavior",
278280
ResourceExhaustion(_) =>
@@ -377,7 +379,7 @@ pub fn report_error<'tcx, 'mir>(
377379
if let Some((alloc_id, access)) = extra {
378380
eprintln!(
379381
"Uninitialized memory occurred at {alloc_id:?}{range:?}, in this allocation:",
380-
range = access.uninit,
382+
range = access.bad,
381383
);
382384
eprintln!("{:?}", ecx.dump_alloc(alloc_id));
383385
}

tests/compiletest.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ fn test_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
5353
// Add some flags we always want.
5454
program.args.push("-Dwarnings".into());
5555
program.args.push("-Dunused".into());
56+
program.args.push("-Ainternal_features".into());
5657
if let Ok(extra_flags) = env::var("MIRIFLAGS") {
5758
for flag in extra_flags.split_whitespace() {
5859
program.args.push(flag.into());

tests/fail/validity/uninit_float.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: constructing invalid value at .value[0]: encountered uninitialized bytes
1+
error: Undefined Behavior: constructing invalid value at .value[0]: encountered uninitialized memory, but expected a floating point number
22
--> $DIR/uninit_float.rs:LL:CC
33
|
44
LL | let _val: [f32; 1] = unsafe { std::mem::uninitialized() };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .value[0]: encountered uninitialized bytes
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .value[0]: encountered uninitialized memory, but expected a floating point number
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/validity/uninit_integer.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: constructing invalid value at .value[0]: encountered uninitialized bytes
1+
error: Undefined Behavior: constructing invalid value at .value[0]: encountered uninitialized memory, but expected an integer
22
--> $DIR/uninit_integer.rs:LL:CC
33
|
44
LL | let _val = unsafe { std::mem::MaybeUninit::<[usize; 1]>::uninit().assume_init() };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .value[0]: encountered uninitialized bytes
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .value[0]: encountered uninitialized memory, but expected an integer
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

0 commit comments

Comments
 (0)