Skip to content

Commit

Permalink
Do not ICE when suggesting elided lifetimes on non-existent spans.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Dec 11, 2021
1 parent d9e997d commit 9a68003
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_resolve/src/late/diagnostics.rs
Expand Up @@ -2115,6 +2115,11 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
})
.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
// `formatters` only contains None and `spans_suggs` is empty.
return;
}
err.multipart_suggestion_verbose(
&format!(
"consider using the `{}` lifetime",
Expand Down

0 comments on commit 9a68003

Please sign in to comment.