Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Aug 29, 2024

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
Collaborator

rustbot commented Aug 29, 2024

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

@rustbot rustbot 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
Collaborator

rustbot commented Aug 29, 2024

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@rust-log-analyzer

This comment has been minimized.

@fmease
Copy link
Member

fmease commented Aug 29, 2024

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

@rustbot rustbot assigned cjgillot and unassigned fmease Aug 29, 2024
@compiler-errors
Copy link
Member Author

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

@cjgillot
Copy link
Contributor

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

@cjgillot cjgillot 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
Member Author

@rustbot ready

@rustbot rustbot 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
Contributor

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Sep 16, 2024

📌 Commit 63405fc has been approved by cjgillot

It is now in the queue for this repository.

@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 Sep 16, 2024
@bors
Copy link
Collaborator

bors commented Sep 16, 2024

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

@bors
Copy link
Collaborator

bors commented Sep 16, 2024

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 16, 2024
@bors bors merged commit 13b5a4e into rust-lang:master Sep 16, 2024
7 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 16, 2024
@rust-timer
Copy link
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.

mean range count
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.

mean range count
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%)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
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
Development

Successfully merging this pull request may close these issues.

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