Add coroutine info to v0 symbol mangling (via DefPath/DefPathData) #143259
+379
−225
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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