Files
rust/compiler
Jacob Pratt c49221b217 Rollup merge of #163613 - estebank:not-general-enough, r=JonathanBrouwer
Tweak the rendering of "not general enough" errors on the old trait solver

- Use a note to point at the source of the unmet obligation instead of labels (makes the order of the error consistent regardless of the order of the code)
- Point at the found impl that doesn't meet the obligation
- In a few cases, remove the same information being printed twice
- Support `#[primary_span] span: Option<Span>` in `Subdiagnostic`s

```
error: implementation of `TheTrait` is not general enough
  --> $DIR/associated-types-eq-hr.rs:96:5
   |
LL |     tuple_one::<Tuple>();
   |     ^^^^^^^^^^^^^^^^^^^^
   |
note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
  --> $DIR/associated-types-eq-hr.rs:59:8
   |
LL | fn tuple_one<T>()
LL | where
LL |     T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>,
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `tuple_one`
note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
  --> $DIR/associated-types-eq-hr.rs:35:1
   |
LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

The output now is closer to what the next trait solver will emit (E0277).
2026-10-03 22:30:33 -04:00
..
2026-09-29 22:18:54 +00:00
2026-09-29 22:18:54 +00:00
2026-09-29 22:18:54 +00:00
2026-09-29 22:18:54 +00:00
2026-09-29 22:18:54 +00:00
2026-09-29 22:18:54 +00:00
2026-09-29 22:18:54 +00:00