Files
rust/compiler/rustc_const_eval/src
Jonathan Brouwer 1cf13b7953 Rollup merge of #163855 - estebank:const-context-spans, r=oli-obk
Include enclosing item's context on const errors

On const errors, when they occur on an item that might be relevant, like in an associated const, render the line of the enclosing item in the error:

```
error[E0080]: evaluation panicked: not yet implemented
  --> $DIR/ice-normalize-inherent-assoc-const.rs:10:28
   |
LL | impl Foo {
LL |     const ASSOC_C: usize = todo!();
   |                            ^^^^^^^ evaluation of `Foo::ASSOC_C` failed here
```
```
error[E0080]: writing to ALLOC$ID which is read-only
  --> $DIR/issue-100313.rs:18:5
   |
LL | const _: () = {
LL |     let x = T::<{ &true }>;
LL |     x.set_false();
   |     ^^^^^^^^^^^^^ evaluation of `_` failed inside this call
   |
note: inside `T::<&true>::set_false`
  --> $DIR/issue-100313.rs:11:13
   |
LL | impl<const B: &'static bool> T<B> {
LL |     const fn set_false(&self) {
LL |         unsafe {
LL |             *(B as *const bool as *mut bool) = false;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the failure occurred here
```
2026-10-08 21:49:57 +02:00
..
2026-09-29 22:18:54 +00:00