rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
93.93k stars 12.09k forks source link

Fix unnamed lifetime spans #125234

Open bovinebuddha opened 2 weeks ago

bovinebuddha commented 2 weeks ago

Fixes issue #125143.

The error message used to mix up two different unnamed lifetimes since they were both assigned the name "'_". Looking up the span using the DefId instead gave correct spans.

I am not sure if a similar fix should be made for any of the other RegionKinds, e.g. ReLateParam, and I am unsure of how to construct a test case which used late bound lifetimes or RePlaceholder.

Maybe the function 'msg_span_from_named_region' should be renamed since it now uses (partially) DefId instead of the name. Also, the name is quite misleading since it is sometimes used to look up unnamed lifetimes...

rustbot commented 2 weeks ago

r? @compiler-errors

rustbot has assigned @compiler-errors. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

bors commented 5 days ago

:umbrella: The latest upstream changes (presumably #125468) made this pull request unmergeable. Please resolve the merge conflicts.