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

debuginfo: give unique names to closure and generator types #63875

Merged
merged 2 commits into from
Aug 28, 2019

Conversation

philipc
Copy link
Contributor

@philipc philipc commented Aug 25, 2019

Closure types have been moved to the namespace where they
are defined, and both closure and generator type names now
include the disambiguator.

This fixes an exception when lldb prints nested closures.

Fixes #57822

I haven't included the DW_AT_artificial changes discussed in #57822 because they make the output worse IMO, but I can easily add these if still required. For example, for the new test case the output is now:

(lldb) p g
(issue_57822::main::closure-1) $1 = closure-1(closure(1))

but adding DW_AT_artificial changes this to:

(lldb) p g
(issue_57822::main::closure-1) $0 = closure-1 {

}

Note that nested generators didn't cause the exception. I haven't determined why, but I think it makes sense to add the disambiguator for them too. It feels like we still don't really understand why closures were causing an error though.

r? @michaelwoerister

Closure types have been moved to the namespace where they
are defined, and both closure and generator type names now
include the disambiguator.

This fixes an exception when lldb prints nested closures.

Fixes rust-lang#57822
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 25, 2019
@michaelwoerister
Copy link
Member

Thanks for the PR, @philipc!

I think this looks great and I'm OK with not adding the DW_AT_artificial attribute at this point. As I mentioned above, I'd prefer if we always appended the disambigutor, even if it is 0. If you change that I'm happy to r+.

@michaelwoerister
Copy link
Member

Thanks, @philipc!

@bors r+

@bors
Copy link
Contributor

bors commented Aug 27, 2019

📌 Commit 61ff27a has been approved by michaelwoerister

@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 Aug 27, 2019
@bors
Copy link
Contributor

bors commented Aug 28, 2019

⌛ Testing commit 61ff27a with merge 17e73e8...

bors added a commit that referenced this pull request Aug 28, 2019
debuginfo: give unique names to closure and generator types

Closure types have been moved to the namespace where they
are defined, and both closure and generator type names now
include the disambiguator.

This fixes an exception when lldb prints nested closures.

Fixes #57822

I haven't included the `DW_AT_artificial` changes discussed in #57822 because they make the output worse IMO, but I can easily add these if still required. For example, for the new test case the output is now:
```
(lldb) p g
(issue_57822::main::closure-1) $1 = closure-1(closure(1))
```
but adding `DW_AT_artificial` changes this to:
```
(lldb) p g
(issue_57822::main::closure-1) $0 = closure-1 {

}
```

Note that nested generators didn't cause the exception. I haven't determined why, but I think it makes sense to add the disambiguator for them too. It feels like we still don't really understand why closures were causing an error though.

r? @michaelwoerister
@bors
Copy link
Contributor

bors commented Aug 28, 2019

☀️ Test successful - checks-azure
Approved by: michaelwoerister
Pushing 17e73e8 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 28, 2019
@bors bors merged commit 61ff27a into rust-lang:master Aug 28, 2019
output.push_str("closure");
ty::Closure(def_id, ..) => {
output.push_str(&format!(
"closure-{}",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would've suggested the same syntax as rustc-demangle, but this is probably fine.
This entire module seems a bit redundant though, but I don't think I have the time to refactor it post-ty::print.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could open an issue and give some mentors.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but that would require me to actually look at what this code is doing.
There might already be an issue open for "things to clean up post-ty::print".

@michaelwoerister michaelwoerister added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Aug 29, 2019
@michaelwoerister
Copy link
Member

Nominating for beta backporting. This should be a low risk change and will make LLDB users happy.

@philipc philipc deleted the issue-57822 branch August 29, 2019 11:26
@michaelwoerister michaelwoerister added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 29, 2019
@nikomatsakis nikomatsakis added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Aug 29, 2019
@nikomatsakis
Copy link
Contributor

Reviewed by the compiler team:

Accepted for beta backport

@pietroalbini pietroalbini removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Sep 2, 2019
bors added a commit that referenced this pull request Sep 3, 2019
[beta] Rollup backports

Rolled up:

* [beta] Utilize released stable over dev-static #64046

Cherry picked:

* Update rust-installer to limit memory use #63984
* debuginfo: give unique names to closure and generator types #63875
* ci: move libc mirrors to the rust-lang-ci-mirrors bucket #63772
* Fix nested eager expansions in arguments of `format_args` #63717

r? @ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. merged-by-bors This PR was explicitly merged by bors. 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
8 participants