Do not ICE when suggesting elided lifetimes on non-existent spans.
This commit is contained in:
parent
d9e997d9eb
commit
9a68003742
1 changed files with 5 additions and 0 deletions
|
@ -2115,6 +2115,11 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
||||||
})
|
})
|
||||||
.map(|(formatter, span)| (*span, formatter(name)))
|
.map(|(formatter, span)| (*span, formatter(name)))
|
||||||
.collect();
|
.collect();
|
||||||
|
if spans_suggs.is_empty() {
|
||||||
|
// If all the spans come from macros, we cannot extract snippets and then
|
||||||
|
// `formatters` only contains None and `spans_suggs` is empty.
|
||||||
|
return;
|
||||||
|
}
|
||||||
err.multipart_suggestion_verbose(
|
err.multipart_suggestion_verbose(
|
||||||
&format!(
|
&format!(
|
||||||
"consider using the `{}` lifetime",
|
"consider using the `{}` lifetime",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue