mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-03 01:25:15 +00:00
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).