Skip to content

Commit ab3ccbe

Browse files
authored
Unrolled build for #142015
Rollup merge of #142015 - oli-obk:wrong-instance, r=RalfJung Report the actual item that evaluation failed for instead of id of the last frame in the evaluation stack r? ``@RalfJung`` fixes #142010
2 parents 0b20963 + 6417248 commit ab3ccbe

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

compiler/rustc_const_eval/src/const_eval/eval_queries.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,12 @@ fn report_eval_error<'tcx>(
454454
// FIXME(oli-obk): figure out how to use structured diagnostics again.
455455
diag.code(E0080);
456456
diag.span_label(span, crate::fluent_generated::const_eval_error);
457-
diag.arg("instance", instance);
458-
diag.arg("error_kind", kind);
459457
for frame in frames {
460458
diag.subdiagnostic(frame);
461459
}
460+
// Add after the frame rendering above, as it adds its own `instance` args.
461+
diag.arg("instance", instance);
462+
diag.arg("error_kind", kind);
462463
},
463464
)
464465
}

tests/ui/consts/miri_unleashed/assoc_const.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0080]: calling non-const function `<Vec<u32> as Drop>::drop`
22
--> $DIR/assoc_const.rs:12:31
33
|
44
LL | const F: u32 = (U::X, 42).1;
5-
| ^ evaluation of `drop_in_place::<Vec<u32>> - shim(Some(Vec<u32>))` failed here
5+
| ^ evaluation of `<std::string::String as Bar<std::vec::Vec<u32>, std::string::String>>::F` failed here
66
|
77
note: inside `drop_in_place::<(Vec<u32>, u32)> - shim(Some((Vec<u32>, u32)))`
88
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL

tests/ui/consts/uninhabited-const-issue-61744.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub const unsafe fn hint_unreachable() -> ! {
1111

1212
trait Const {
1313
const CONSTANT: i32 = unsafe { fake_type() }; //~ ERROR reached the configured maximum number of stack frames
14+
//~^ NOTE evaluation of `<i32 as Const>::CONSTANT` failed here
1415
}
1516

1617
impl<T> Const for T {}

tests/ui/consts/uninhabited-const-issue-61744.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0080]: reached the configured maximum number of stack frames
22
--> $DIR/uninhabited-const-issue-61744.rs:13:36
33
|
44
LL | const CONSTANT: i32 = unsafe { fake_type() };
5-
| ^^^^^^^^^^^ evaluation of `fake_type::<!>` failed here
5+
| ^^^^^^^^^^^ evaluation of `<i32 as Const>::CONSTANT` failed here
66
|
77
note: inside `fake_type::<i32>`
88
--> $DIR/uninhabited-const-issue-61744.rs:5:5

0 commit comments

Comments
 (0)