WIP: Thread GeneratorKind through to symbol mangling#104333
WIP: Thread GeneratorKind through to symbol mangling#104333Swatinem wants to merge 1 commit intorust-lang:masterfrom
GeneratorKind through to symbol mangling#104333Conversation
The current symbol mangling (legacy and v0) do not differentiate between closures and async fns / blocks, which is suboptimal when looking at debuginfo or stack traces. This lays the groundwork to eventually add these special kinds of closures to the mangling scheme.
|
r? @lcnr (rustbot has picked a reviewer for you, use r? to override) |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
| // we must create two defs. | ||
| let closure_def = self.create_def(expr.id, DefPathData::ClosureExpr, expr.span); | ||
| let closure_def = | ||
| self.create_def(expr.id, DefPathData::ClosureExpr(None), expr.span); |
There was a problem hiding this comment.
The closure could still be a regular generator if the body contains a yield.
It should be included here, otherwise we'll have an inconsistency between the DefPath and HIR.
|
☔ The latest upstream changes (presumably #101562) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@Swatinem any updates on this? |
|
I would need some mentoring especially around how to make changes to the mangling scheme, as I believe changes might be needed there. From the code perspective, there is not really a blocker, I can do a rebase anytime. |
|
@Swatinem any updates on this? if you need help/mentorship I would recommend creating a thread on zulip. If you have already done so, you can link the thread here for easier tracking. Thanks |
|
Well its been almost a year since creating that thread: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/async.20symbol.20mangling/near/312022530 The main thing I would need help with is understanding which moving pieces need to be taken care of. |
|
A new thread will be better for visibility. |
|
Alright, here you go: In the meantime I will start updating this PR to resolve all the conflicts. |
|
This has diverged quite a bit and rebasing has become difficult. |
The current symbol mangling (legacy and v0) do not differentiate between closures and async fns / blocks, which is suboptimal when looking at debuginfo or stack traces.
This lays the groundwork to eventually add these special kinds of closures to the mangling scheme.
As it is implemented right now, this has a subtle problem when not yet outputting a different mangling for each
GeneratorKind:DefPathData::ClosureExprnowHash-es differently depending on the innerGeneratorKind, so it can potentially reuse the samedisambiguator.I can potentially work around that, though it would be nicer to just have different mangling for each of those types ;-)