Skip to content

Fix coverage ICE because fn_sig can have a span that crosses file bou… #84532

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 27, 2021

Conversation

richkadel
Copy link
Contributor

@richkadel richkadel commented Apr 24, 2021

Fixes: #83792

MIR InstrumentCoverage assumed the FnSig span was contained within a
single file, but this is not always the case. Some macro constructions
can result in a span that starts in one SourceFile and ends in a
different one.

The FnSig span is included in coverage results as long as that span is
in the same SourceFile and the same macro context, but by assuming the
FnSig span's hi() and lo() were in the same file, I took this for
granted, and checked only that the FnSig hi() was in the same
SourceFile as the body_span.

I actually drop the hi() though, and extend the FnSig span to the
body_span.lo(), so I really should have simply checked that the
FnSig span's lo() was in the SourceFile of the body_span.

r? @tmandry
cc: @wesleywiser

…ndaries

Fixes: rust-lang#83792

MIR `InstrumentCoverage` assumed the `FnSig` span was contained within a
single file, but this is not always the case. Some macro constructions
can result in a span that starts in one `SourceFile` and ends in a
different one.

The `FnSig` span is included in coverage results as long as that span is
in the same `SourceFile` and the same macro context, but by assuming the
`FnSig` span's `hi()` and `lo()` were in the same file, I took this for
granted, and checked only that the `FnSig` `hi()` was in the same
`SourceFile` as the `body_span`.

I actually drop the `hi()` though, and extend the `FnSig` span to the
`body_span.lo()`, so I really should have simply checked that the
`FnSig` span's `lo()` was in the `SourceFile` of the `body_span`.
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 24, 2021
@richkadel
Copy link
Contributor Author

@tmandry - If the first email for this PR did not match the title, please ignore it. (An older PR's description was added in error, but I've updated it.)

This is the correct description:

Fix coverage ICE because fn_sig can have a span that crosses file boundaries

Fixes: #83792

MIR InstrumentCoverage assumed the FnSig span was contained within a
single file, but this is not always the case. Some macro constructions
can result in a span that starts in one SourceFile and ends in a
different one.

The FnSig span is included in coverage results as long as that span is
in the same SourceFile and the same macro context, but by assuming the
FnSig span's hi() and lo() were in the same file, I took this for
granted, and checked only that the FnSig hi() was in the same
SourceFile as the body_span.

I actually drop the hi() though, and extend the FnSig span to the
body_span.lo(), so I really should have simply checked that the
FnSig span's lo() was in the SourceFile of the body_span.

@tmandry
Copy link
Member

tmandry commented Apr 26, 2021

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Apr 26, 2021

📌 Commit 31cba57 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 26, 2021
@bors
Copy link
Collaborator

bors commented Apr 27, 2021

⌛ Testing commit 31cba57 with merge e188693...

@bors
Copy link
Collaborator

bors commented Apr 27, 2021

☀️ Test successful - checks-actions
Approved by: tmandry
Pushing e188693 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 27, 2021
@bors bors merged commit e188693 into rust-lang:master Apr 27, 2021
@rustbot rustbot added this to the 1.53.0 milestone Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

Internal compiler error while running llvm-tools-preview
5 participants