about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-11-10 17:43:07 +0100
committerGitHub <noreply@github.com>2024-11-10 17:43:07 +0100
commitb95232dabba2ebc6da15ff700f6b3a37bac34957 (patch)
treee1942225191c22c5e0d8e69dc805eb7d96f41ab9 /compiler/rustc_errors/src
parentc22887b4d97400e8e024e19fb5f724eda65ad58d (diff)
parent925dfc8608e1906e0fc51518f9b0cf40f22a5618 (diff)
downloadrust-b95232dabba2ebc6da15ff700f6b3a37bac34957.tar.gz
rust-b95232dabba2ebc6da15ff700f6b3a37bac34957.zip
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.
Diffstat (limited to 'compiler/rustc_errors/src')
0 files changed, 0 insertions, 0 deletions