Skip to content
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

Account for identity substituted items in symbol mangling #135261

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

compiler-errors
Copy link
Member

See the inline comment.

r? oli-obk

Fixes #135235

@rustbot rustbot 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
Collaborator

rustbot commented Jan 8, 2025

Some changes occurred in coverage tests.

cc @Zalathar

@Zalathar
Copy link
Contributor

Zalathar commented Jan 9, 2025

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
Member Author

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
Contributor

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
Member Author

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
Contributor

oli-obk commented Jan 9, 2025

@bors r+

@bors
Copy link
Contributor

bors commented Jan 9, 2025

📌 Commit 921c449 has been approved by oli-obk

It is now in the queue for this repository.

@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 Jan 9, 2025
@lcnr
Copy link
Contributor

lcnr commented Jan 9, 2025

i added a comment to the ui test

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Jan 9, 2025

📌 Commit 4dc5604 has been approved by oli-obk

It is now in the queue for this repository.

@rust-log-analyzer

This comment has been minimized.

@lcnr
Copy link
Contributor

lcnr commented Jan 9, 2025

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 lcnr force-pushed the coverage-has-identity-substs branch from 91e1e70 to b85b2c6 Compare January 9, 2025 12:55
@lcnr
Copy link
Contributor

lcnr commented Jan 9, 2025

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Jan 9, 2025

📌 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:master Jan 9, 2025
6 checks passed
@rustbot rustbot 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

Fixes rust-lang#135235
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant 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