-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Add coroutine info to v0 symbol mangling (via DefPath/DefPathData) #143259
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
base: master
Are you sure you want to change the base?
Conversation
... and, make that available via `get_opt_name()` so that it shows up in symbol mangling.
Some changes occurred in coverage tests. cc @Zalathar Some changes occurred in match checking cc @Nadrieril Some changes occurred in compiler/rustc_codegen_ssa Some changes occurred in compiler/rustc_sanitizers cc @rcvalle Some changes occurred to the CTFE machinery Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt HIR ty lowering was modified cc @fmease |
I wonder if a simpler approach here would be to make a Then in the demangler, you could instead just intercept the Not sure if that's possible. |
The job Click to see the possible cause of the failure (guessed by this bot)
|
That would definitely be much better 😅 AFAICT the earliest point where coroutine info is available is when HIR nodes are constructed, but those can only be accessed by I thought it wouldn't work for that reason, but from what you said - do I understand correctly that if a query has If so, we can probably just use the |
☔ The latest upstream changes (presumably #143434) made this pull request unmergeable. Please resolve the merge conflicts. |
See #104830 (comment) for some context.
The high-level goal here is to change the v0 symbol mangling to include any relevant coroutine information for closures — i.e. if it's been desugared from
async
,gen
, or#[coroutine]
blocks/closures.Example of the intended change
So the idea is to move from this:
to this:
To do that, this PR:
rustc_hir::DefKind
rustc_hir::DefPathData
DefPathData::get_opt_name
so that it shows up as{closure:<coroutine kind>}
in symbol manglingDefPathData
coroutine info inDefPathDataName
to have similar{closure:async}
formatting in other placesIdeally it wouldn't have required threading this information everywhere, but AFAICT the only other way to do it would be via accessing HIR nodes during type printing, which IIUC won't work because we can only get HIR nodes for the local crate (?)
This PR affects a few different areas, so I'm not totally sure who to ping for review. Also more than happy to split it up into a few smaller PRs, if that'd be useful.
r? rust-lang/compiler