Skip to content

Don't use typeck_root_def_id in codegen for finding closure's root - #129716

Merged
bors merged 1 commit into
rust-lang:masterfrom
compiler-errors:closure-debuginfo
Sep 16, 2024
Merged

Don't use typeck_root_def_id in codegen for finding closure's root#129716
bors merged 1 commit into
rust-lang:masterfrom
compiler-errors:closure-debuginfo

Conversation

@compiler-errors

@compiler-errorscompiler-errors commented Aug 29, 2024

Copy link
Copy Markdown
Contributor

Generating debuginfo in codegen currently peels off all the closure-specific generics (which presumably is done because they're redundant). This doesn't currently work correctly for the bodies we synthesize for async closures's returned coroutines (#128506), leading to #129702.

Specifically, typeck_root_def_id for some DefKind::SyntheticCoroutineBody just returns itself (because it loops while is_typeck_child is true, and that returns false for this defkind), which means we don't end up peeling off the coroutine-specific generics, and we end up encountering an otherwise unreachable CoroutineWitness type leading to an ICE.

This PR fixes is_typeck_child to consider DefKind::SyntheticCorotuineBody to be a typeck child, fixing typeck_root_def_id and suppressing this debuginfo bug.

Fixes#129702

@rustbot

Copy link
Copy Markdown
Collaborator

r? @fmease

rustbot has assigned @fmease.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 29, 2024
@rustbot

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

Comment threadcompiler/rustc_middle/src/ty/util.rs
@rust-log-analyzer

This comment has been minimized.

@fmease

Copy link
Copy Markdown
Member

I lack the necessary familiarity and context
r? cjgillot (#128506)

@rustbotrustbot assigned cjgillot and unassigned fmeaseAug 29, 2024
@compiler-errors

Copy link
Copy Markdown
ContributorAuthor

@cjgillot: Are you available to review this, or should I re-roll?

@cjgillot

Copy link
Copy Markdown
Contributor

I'll get to it this weekend, sorry for the delay.

@cjgillotcjgillot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 14, 2024
@compiler-errors

Copy link
Copy Markdown
ContributorAuthor

@rustbot ready

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 15, 2024
@cjgillot

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@bors

bors commented Sep 16, 2024

Copy link
Copy Markdown
Collaborator

📌 Commit 63405fc has been approved by cjgillot

It is now in the queue for this repository.

@borsbors 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 Sep 16, 2024
@bors

bors commented Sep 16, 2024

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 63405fc with merge 13b5a4e...

@bors

bors commented Sep 16, 2024

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 13b5a4e to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Sep 16, 2024
@bors
bors merged commit 13b5a4e into rust-lang:masterSep 16, 2024
@rustbotrustbot added this to the 1.83.0 milestone Sep 16, 2024
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (13b5a4e): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -2.6%, secondary -0.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
2.7%[2.7%, 2.7%]1
Improvements ✅
(primary)
-2.6%[-2.6%, -2.6%]1
Improvements ✅
(secondary)
-3.7%[-3.7%, -3.7%]1
All ❌✅ (primary)-2.6%[-2.6%, -2.6%]1

Cycles

Results (primary 1.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

meanrangecount
Regressions ❌
(primary)
1.5%[1.5%, 1.5%]1
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)1.5%[1.5%, 1.5%]1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 760.015s -> 759.454s (-0.07%)
Artifact size: 341.34 MiB -> 341.32 MiB (-0.01%)

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE: debuginfo: Trying to create type name for unexpected type: CoroutineWitness

7 participants

@compiler-errors@rustbot@rust-log-analyzer@fmease@cjgillot@bors@rust-timer