Skip to content

Account for identity substituted items in symbol mangling - #135261

Merged
bors merged 2 commits into
rust-lang:masterfrom
compiler-errors:coverage-has-identity-substs
Jan 9, 2025
Merged

Account for identity substituted items in symbol mangling#135261
bors merged 2 commits into
rust-lang:masterfrom
compiler-errors:coverage-has-identity-substs

Conversation

@compiler-errors

Copy link
Copy Markdown
Contributor

See the inline comment.

r? oli-obk

Fixes#135235

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 8, 2025
@rustbot

Copy link
Copy Markdown
Collaborator

Some changes occurred in coverage tests.

cc @Zalathar

@Zalathar

Copy link
Copy Markdown
Member

Is there anything that coverage could potentially do differently to make this less of a hassle?

For unused non-generic functions, we want to synthesize the same symbol as if that function had actually been emitted. But for unused generic functions we have a bit more latitude, since the symbol name is fundamentally fake. The biggest constraint is that it has to demangle into something that the user can understand.

@compiler-errors

Copy link
Copy Markdown
ContributorAuthor

Nah, this was just an oversight on my part. I think this is really the only choice we have for unused symbols.

Comment on lines +397 to +400
// 2. We're mangling an item with identity substs. This seems to only happen
// when generating coverage, since we try to generate coverage for unused
// items too, and if something isn't monomorphized then we necessarily don't
// have anything to substitute the instance with.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that -Cinstrument-coverage automatically implies -Csymbol-mangling-version=v0, so normally this case shouldn't arise for legacy mangling ...

... except that if you explicitly do -Cinstrument-coverage -Csymbol-mangling-version=legacy -Zunstable-options, you do end up with coverage instrumentation using legacy mangling anyway, with only a compiler warning. So this case can arise after all.

(In other words, I don't think there's anything actionable in this review comment; I just wanted to note my sadness.)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's nbd, I'd rather keep these in sync even if the legacy branch is never exercised.

@oli-obk

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jan 9, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 921c449 has been approved by oli-obk

It is now in the queue for this repository.

@borsbors 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 Jan 9, 2025
Comment threadtests/coverage/generic-unused-impl.rs
@lcnr

lcnr commented Jan 9, 2025

Copy link
Copy Markdown
Contributor

i added a comment to the ui test

@bors r=oli-obk

@bors

bors commented Jan 9, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 4dc5604 has been approved by oli-obk

It is now in the queue for this repository.

Comment threadtests/coverage/generic-unused-impl.coverage
@rust-log-analyzer

This comment has been minimized.

@lcnr

lcnr commented Jan 9, 2025

Copy link
Copy Markdown
Contributor

if i had known it would cause ci failures i would have ignored that 😅 gonna check it out locally to fix and then force-puzsh

@lcnr
lcnrforce-pushed the coverage-has-identity-substs branch from 91e1e70 to b85b2c6CompareJanuary 9, 2025 12:55
@lcnr

lcnr commented Jan 9, 2025

Copy link
Copy Markdown
Contributor

@bors r=oli-obk

@bors

bors commented Jan 9, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit b85b2c6 has been approved by oli-obk

It is now in the queue for this repository.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 9, 2025
…iaskrgr
Rollup of 3 pull requests
Successful merges:
- rust-lang#134898 (Make it easier to run CI jobs locally)
- rust-lang#135195 (Make `lit_to_mir_constant` and `lit_to_const` infallible)
- rust-lang#135261 (Account for identity substituted items in symbol mangling)
r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 9, 2025
…iaskrgr
Rollup of 3 pull requests
Successful merges:
- rust-lang#134898 (Make it easier to run CI jobs locally)
- rust-lang#135195 (Make `lit_to_mir_constant` and `lit_to_const` infallible)
- rust-lang#135261 (Account for identity substituted items in symbol mangling)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 41c7d5a into rust-lang:masterJan 9, 2025
@rustbotrustbot added this to the 1.86.0 milestone Jan 9, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 9, 2025
Rollup merge of rust-lang#135261 - compiler-errors:coverage-has-identity-substs, r=oli-obk
Account for identity substituted items in symbol mangling
See the inline comment.
r? oli-obk
Fixesrust-lang#135235
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE building smallvec with coverage support (nightly-to-nightly regression)

7 participants

@compiler-errors@rustbot@Zalathar@oli-obk@bors@lcnr@rust-log-analyzer