X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_lint%2Fsrc%2Funused.rs;h=ecaf1c44354c5abf5c9d50084f83c2a5e61490d7;hb=a67649675014546ce454d65bc8fe3ebd18e6a319;hp=d829ca43328fe651422bf31ad61ef2e955bbfe9c;hpb=c9270272df5bd7254b6ce1c7b69d41c75e443406;p=rust.git diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index d829ca43328..ecaf1c44354 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -663,6 +663,10 @@ fn emit_unused_delims( keep_space: (bool, bool), ) { let primary_span = if let Some((lo, hi)) = spans { + if hi.is_empty() { + // do not point at delims that do not exist + return; + } MultiSpan::from(vec![lo, hi]) } else { MultiSpan::from(value_span)