Skip to content

Commit ab46740

Browse files
committed
Auto merge of #114424 - matthiaskrgr:rollup-cegblvo, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #113657 (Expand, rename and improve `incorrect_fn_null_checks` lint) - #114237 (parser: more friendly hints for handling `async move` in the 2015 edition) - #114300 (Suggests turbofish in patterns) - #114372 (const validation: point at where we found a pointer but expected an integer) - #114395 ([rustc_span][perf] Hoist lookup sorted by words out of the loop.) - #114403 (fix the span in the suggestion of remove question mark) - #114408 (Temporary remove myself from review rotation) - #114415 (Skip checking of `rustc_codegen_gcc` with vendoring enabled) r? `@ghost` `@rustbot` modify labels: rollup
2 parents f5eacdd + 533af2f commit ab46740

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/diagnostics.rs

+3-1
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/fail/validity/uninit_float.stderr

+2-2
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

+2-2
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)