-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
WIP: Thread GeneratorKind
through to symbol mangling
#104333
Conversation
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)
|
@@ -265,16 +268,24 @@ impl<'a, 'b> visit::Visitor<'a> for DefCollector<'a, 'b> { | |||
ExprKind::Closure(_, _, asyncness, ..) => { | |||
// Async closures desugar to closures inside of closures, so | |||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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::ClosureExpr
nowHash
-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 ;-)