Skip to content

Commit 9a68003

Browse files
committed
Do not ICE when suggesting elided lifetimes on non-existent spans.
1 parent d9e997d commit 9a68003

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/rustc_resolve/src/late/diagnostics.rs

+5
Original file line numberDiff line numberDiff line change
@@ -2115,6 +2115,11 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
21152115
})
21162116
.map(|(formatter, span)| (*span, formatter(name)))
21172117
.collect();
2118+
if spans_suggs.is_empty() {
2119+
// If all the spans come from macros, we cannot extract snippets and then
2120+
// `formatters` only contains None and `spans_suggs` is empty.
2121+
return;
2122+
}
21182123
err.multipart_suggestion_verbose(
21192124
&format!(
21202125
"consider using the `{}` lifetime",

0 commit comments

Comments
 (0)