about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-07-23 16:59:13 +0000
committerbors <bors@rust-lang.org>2025-07-23 16:59:13 +0000
commit29a58723b05d004c2e19ddcf2be80d514401f22e (patch)
tree8805c7e6747f15680624530670d284f7bb22dd80 /compiler/rustc_codegen_llvm/src
parent4ff3fa01cbdd468851b1b859541ee1c648cde7de (diff)
parentd444815a31c9ed80e90dfd80f8dd371c915bfafd (diff)
downloadrust-29a58723b05d004c2e19ddcf2be80d514401f22e.tar.gz
rust-29a58723b05d004c2e19ddcf2be80d514401f22e.zip
Auto merge of #144360 - matthiaskrgr:rollup-b6ej0mm, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#144173 (Remove tidy checks for `tests/ui/issues/`)
 - rust-lang/rust#144234 (Fix broken TLS destructors on 32-bit win7)
 - rust-lang/rust#144239 (Clean `rustc/parse/src/lexer` to improve maintainability)
 - rust-lang/rust#144256 (Don't ICE on non-TypeId metadata within TypeId)
 - rust-lang/rust#144290 (update tests/ui/SUMMARY.md)
 - rust-lang/rust#144292 (mbe: Use concrete type for `get_unused_rule`)
 - rust-lang/rust#144298 (coverage: Enlarge empty spans during MIR instrumentation, not codegen)
 - rust-lang/rust#144311 (Add powerpc64le-unknown-linux-musl to CI rustc targets)
 - rust-lang/rust#144315 (bootstrap: add package.json and package-lock.json to dist tarball)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/spans.rs28
1 files changed, 4 insertions, 24 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/spans.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/spans.rs
index 39a59560c9d..574463be7ff 100644
--- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/spans.rs
+++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/spans.rs
@@ -39,7 +39,10 @@ impl Coords {
 /// or other expansions), and if it does happen then skipping a span or function is
 /// better than an ICE or `llvm-cov` failure that the user might have no way to avoid.
 pub(crate) fn make_coords(source_map: &SourceMap, file: &SourceFile, span: Span) -> Option<Coords> {
-    let span = ensure_non_empty_span(source_map, span)?;
+    if span.is_empty() {
+        debug_assert!(false, "can't make coords from empty span: {span:?}");
+        return None;
+    }
 
     let lo = span.lo();
     let hi = span.hi();
@@ -70,29 +73,6 @@ pub(crate) fn make_coords(source_map: &SourceMap, file: &SourceFile, span: Span)
     })
 }
 
-fn ensure_non_empty_span(source_map: &SourceMap, span: Span) -> Option<Span> {
-    if !span.is_empty() {
-        return Some(span);
-    }
-
-    // The span is empty, so try to enlarge it to cover an adjacent '{' or '}'.
-    source_map
-        .span_to_source(span, |src, start, end| try {
-            // Adjusting span endpoints by `BytePos(1)` is normally a bug,
-            // but in this case we have specifically checked that the character
-            // we're skipping over is one of two specific ASCII characters, so
-            // adjusting by exactly 1 byte is correct.
-            if src.as_bytes().get(end).copied() == Some(b'{') {
-                Some(span.with_hi(span.hi() + BytePos(1)))
-            } else if start > 0 && src.as_bytes()[start - 1] == b'}' {
-                Some(span.with_lo(span.lo() - BytePos(1)))
-            } else {
-                None
-            }
-        })
-        .ok()?
-}
-
 /// If `llvm-cov` sees a source region that is improperly ordered (end < start),
 /// it will immediately exit with a fatal error. To prevent that from happening,
 /// discard regions that are improperly ordered, or might be interpreted in a