]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_lint/src/unused.rs
Auto merge of #107663 - matthiaskrgr:107423-point-at-EOF-code, r=compiler-errors
[rust.git] / compiler / rustc_lint / src / unused.rs
index d829ca43328fe651422bf31ad61ef2e955bbfe9c..ecaf1c44354c5abf5c9d50084f83c2a5e61490d7 100644 (file)
@@ -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)