coverage: Restrict empty-span expansion to only cover { and }#132675
Merged
bors merged 5 commits intorust-lang:masterfrom Nov 10, 2024
Merged
coverage: Restrict empty-span expansion to only cover { and }#132675bors merged 5 commits intorust-lang:masterfrom
{ and }#132675bors merged 5 commits intorust-lang:masterfrom
Conversation
Collaborator
|
r? @fee1-dead rustbot has assigned @fee1-dead. Use |
Collaborator
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
Member
|
r? compiler |
Member
|
r? jieyouxu |
Zalathar
commented
Nov 8, 2024
This isn't strictly necessary, but makes it easier to distinguish `body_span` from the specific `span` being processed.
We already had a dedicated `LocalFileId` index type, but previously we used a raw `u32` for global file IDs, because index types were harder to pass through FFI.
Functions currently can't have mappings in multiple files, and if that ever changes (e.g. to properly support expansion regions), this code will need to be completely overhauled anyway.
jieyouxu
approved these changes
Nov 9, 2024
Member
|
@rustbot author |
9287332 to
925dfc8
Compare
Member
Author
Member
|
Thanks! @bors r+ |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Nov 10, 2024
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.
Member
|
@bors retry r- (yielding priority to a revert to fix a bootstrap issue) |
Member
|
@bors r+ |
Collaborator
Member
|
(Yielding to #132846) |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Nov 10, 2024
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.
Collaborator
Member
|
@bors r- retry |
Member
|
@bors r+ |
Collaborator
Collaborator
|
🌲 The tree is currently closed for pull requests below priority 1000. This pull request will be tested once the tree is reopened. |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Nov 10, 2024
…iaskrgr Rollup of 3 pull requests Successful merges: - rust-lang#132675 (coverage: Restrict empty-span expansion to only cover `{` and `}`) - rust-lang#132849 (Miri subtree update) - rust-lang#132858 (Update minifer version to `0.3.2`) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Nov 10, 2024
Rollup merge of rust-lang#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.
mati865
pushed a commit
to mati865/rust
that referenced
this pull request
Nov 12, 2024
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.
mati865
pushed a commit
to mati865/rust
that referenced
this pull request
Nov 12, 2024
…iaskrgr Rollup of 3 pull requests Successful merges: - rust-lang#132675 (coverage: Restrict empty-span expansion to only cover `{` and `}`) - rust-lang#132849 (Miri subtree update) - rust-lang#132858 (Update minifer version to `0.3.2`) r? `@ghost` `@rustbot` modify labels: rollup
github-merge-queue bot
pushed a commit
to model-checking/kani
that referenced
this pull request
Nov 13, 2024
Changes required due to - rust-lang/rust#132675 (coverage: Restrict empty-span expansion to only cover { and }) By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Coverage instrumentation has some tricky code for converting a coverage-relevant
Spaninto 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.