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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
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)
5 participants