rust/compiler/rustc_span/src
Matthias Krüger b95232dabb
Rollup merge of #132675 - Zalathar:empty-spans, r=jieyouxu
coverage: Restrict empty-span expansion to only cover `{` and `}`

Coverage instrumentation has some tricky code for converting a coverage-relevant `Span` into a set of start/end line/byte-column coordinates that will be embedded in the CGU's coverage metadata.

A big part of this complexity is special code for handling empty spans, which are expanded into non-empty spans (if possible) because LLVM's coverage reporter does not handle empty spans well.

This PR simplifies that code by restricting it to only apply in two specific situations: when the character after the empty span is `{`, or the character before the empty span is `}`.

(As an added benefit, this means that the expanded spans no longer extend awkwardly beyond the end of a physical line, which was common under the previous implementation.)

Along the way, this PR also removes some unhelpful code for dealing with function source code spread across multiple files. Functions currently can't have coverage spans in multiple files, and if that ever changes (e.g. to properly support expansion regions) then this code will need to be completely overhauled anyway.
2024-11-10 17:43:07 +01:00
..
analyze_source_file Be more accurate about calculating display_col from a BytePos 2024-07-18 20:08:38 +00:00
edit_distance Add test for precise algorithm used 2023-02-19 22:59:22 +00:00
source_map Avoid another &Lrc<..> in a return value. 2024-10-07 13:59:50 +11:00
symbol Reformat use declarations. 2024-07-29 08:26:52 +10:00
analyze_source_file.rs Add warn(unreachable_pub) to rustc_span. 2024-09-03 08:49:54 +10:00
caching_source_map_view.rs fix clippy::clone_on_ref_ptr for compiler 2024-10-28 18:05:08 +03:00
def_id.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
edit_distance.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
edition.rs Remove extern crate rustc_macros from numerous crates. 2024-04-29 10:21:54 +10:00
fatal_error.rs Auto merge of #117557 - Zoxc:panic-prio, r=petrochenkov 2023-11-09 00:39:02 +00:00
hygiene.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
lib.rs Avoid another &Lrc<..> in a return value. 2024-10-07 13:59:50 +11:00
profiling.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
source_map.rs coverage: Restrict empty-span expansion to only cover { and } 2024-11-08 20:43:08 +11:00
span_encoding.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
symbol.rs Rollup merge of #132552 - taiki-e:sparc-target-feature, r=workingjubilee 2024-11-09 10:52:03 +01:00
tests.rs add unstable support for outputting file checksums for use in cargo 2024-10-01 21:23:20 -06:00