Rollup merge of #92333 - compiler-errors:elided-lifetime-spans, r=cjgillot
Tighten span when suggesting lifetime on path This is kind of a hack. Really the issue here is that we want to suggest the segment's span if the path resolves to something defined outside of the macro, and the macro's span if it resolves to something defined within.. I'll look into seeing if we can do something like that. Fixes #92324 r? `@cjgillot`
This commit is contained in:
commit
98c61b673e
5 changed files with 89 additions and 7 deletions
|
@ -2115,10 +2115,13 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
|||
let spans_suggs: Vec<_> = formatters
|
||||
.into_iter()
|
||||
.zip(spans_with_counts.iter())
|
||||
.filter_map(|(fmt, (span, _))| {
|
||||
if let Some(formatter) = fmt { Some((formatter, span)) } else { None }
|
||||
.filter_map(|(formatter, (span, _))| {
|
||||
if let Some(formatter) = formatter {
|
||||
Some((*span, formatter(name)))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.map(|(formatter, span)| (*span, formatter(name)))
|
||||
.collect();
|
||||
if spans_suggs.is_empty() {
|
||||
// If all the spans come from macros, we cannot extract snippets and then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue