Skip to content

Improve coverage spans for chained function calls #84529

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Apr 28, 2021

Conversation

richkadel
Copy link
Contributor

Fixes: #84180

For chained function calls separated by the ? try operator, the
function call following the try operator produced a MIR Call span that
matched the span of the first call. The ? try operator started a new
span, so the second call got no span.

It turns out the MIR Call terminator has a func Operand
for the Constant representing the function name, and the function
name's Span can be used to reset the starting position of the span.

r? @tmandry
cc: @wesleywiser

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 24, 2021
Fixes: rust-lang#84180

For chained function calls separated by the `?` try operator, the
function call following the try operator produced a MIR `Call` span that
matched the span of the first call. The `?` try operator started a new
span, so the second call got no span.

It turns out the MIR `Call` terminator has a `func` `Operand`
for the `Constant` representing the function name, and the function
name's Span can be used to reset the starting position of the span.
@richkadel richkadel changed the title Improve spans for chained function calls Improve coverage spans for chained function calls Apr 26, 2021
@tmandry
Copy link
Member

tmandry commented Apr 28, 2021

Nice.

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Apr 28, 2021

📌 Commit 41667e8 has been approved by tmandry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 28, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 28, 2021
Rollup of 5 pull requests

Successful merges:

 - rust-lang#84529 (Improve coverage spans for chained function calls)
 - rust-lang#84616 (Fix empty dom toggle)
 - rust-lang#84622 (Make traits with GATs not object safe)
 - rust-lang#84624 (Make sentence in env::args_os' docs plain and simple)
 - rust-lang#84642 (Stabilize vec_extend_from_within)

Failed merges:

 - rust-lang#84636 (rustdoc: change aliases attribute to data-aliases)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3f89ca1 into rust-lang:master Apr 28, 2021
@rustbot rustbot added this to the 1.53.0 milestone Apr 28, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

-Zinstrument-coverage producing coverage report which claims line is never run
6 participants