Skip to content

Conversation

@BoxyUwU
Copy link
Member

@BoxyUwU BoxyUwU commented Dec 15, 2025

Fixes #149977
Fixes #148838

Accidentally left this out of #149136 even though being able to do this was a large part of the point of the PR :3

First ICE was caused by the fact that we create a defid but never lower the nodeid associated with it to a hirid which later parts of the compiler can't handle.

See test for second ICE

r? oli-obk

@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 Dec 15, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 15, 2025

oli-obk is not on the review rotation at the moment.
They may take a while to respond.

#![expect(incomplete_features)]
// library crates exercise weirder code paths around
// DefIds which were created for const args.
#![crate_type = "lib"]
Copy link
Member Author

Choose a reason for hiding this comment

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

annoying that I literally went out of my way to add test cases for the ICEing code to catch stuff like this but it just didn't matter because the ICE occurs during metadata encoding or sth instead of some kind of HIR validation step

@BoxyUwU BoxyUwU force-pushed the mgca_no_unused_defids branch from 42f9ae3 to 487cd4f Compare December 15, 2025 15:31

fn visit_anon_const(&mut self, constant: &'a AnonConst) {
if let MgcaDisambiguation::Direct = constant.mgca_disambiguation
&& self.resolver.tcx.features().min_generic_const_args()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the additional feature gate check necessary?

Copy link
Member Author

@BoxyUwU BoxyUwU Dec 15, 2025

Choose a reason for hiding this comment

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

Yep, we can't set MgcaDisambiguation differently depending on whether the feature gate is enabled or not (as the parser doesn't have access to such information). So the enum is really a "if mgca is enabled, this should/shouldnt be an anon const", without mgca enabled the enum is basically meaningless

@BoxyUwU BoxyUwU force-pushed the mgca_no_unused_defids branch from d1d807a to dbfc8c2 Compare December 15, 2025 22:59
@oli-obk
Copy link
Contributor

oli-obk commented Dec 16, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 16, 2025

📌 Commit dbfc8c2 has been approved by oli-obk

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 Dec 16, 2025
bors added a commit that referenced this pull request Dec 16, 2025
…uwer

Rollup of 11 pull requests

Successful merges:

 - #147939 (Make `const BorrowMut` require `const Borrow` and make `const Fn` require `const FnMut`)
 - #149734 (Mirror GCC 9.5.0)
 - #149767 (Tidying up tests/ui/issues 33 tests [4/N])
 - #149804 (chore: fix some minor issues in the comments)
 - #149967 (custom `VaList` layout for Hexagon)
 - #150025 (dont create unnecessary `DefId`s under mgca)
 - #150032 (Use annotate-snippet as default emitter on stable)
 - #150033 (Add try_as_dyn and try_as_dyn_mut)
 - #150042 (rustc-dev-guide subtree update)
 - #150063 (Remove deny of manual-let-else)
 - #150064 (std: io: error: Add comment for UEFI unpacked repr use)

Failed merges:

 - #150044 (Avoid unhelpful suggestion when crate name is invalid)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9308518 into rust-lang:main Dec 17, 2025
11 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Dec 17, 2025
rust-timer added a commit that referenced this pull request Dec 17, 2025
Rollup merge of #150025 - BoxyUwU:mgca_no_unused_defids, r=oli-obk

dont create unnecessary `DefId`s under mgca

Fixes #149977
Fixes #148838

Accidentally left this out of #149136 even though being able to do this was a large part of the point of the PR :3

First ICE was caused by the fact that we create a defid but never lower the nodeid associated with it to a hirid which later parts of the compiler can't handle.

See test for second ICE

r? oli-obk
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Dec 17, 2025
…uwer

Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#147939 (Make `const BorrowMut` require `const Borrow` and make `const Fn` require `const FnMut`)
 - rust-lang/rust#149734 (Mirror GCC 9.5.0)
 - rust-lang/rust#149767 (Tidying up tests/ui/issues 33 tests [4/N])
 - rust-lang/rust#149804 (chore: fix some minor issues in the comments)
 - rust-lang/rust#149967 (custom `VaList` layout for Hexagon)
 - rust-lang/rust#150025 (dont create unnecessary `DefId`s under mgca)
 - rust-lang/rust#150032 (Use annotate-snippet as default emitter on stable)
 - rust-lang/rust#150033 (Add try_as_dyn and try_as_dyn_mut)
 - rust-lang/rust#150042 (rustc-dev-guide subtree update)
 - rust-lang/rust#150063 (Remove deny of manual-let-else)
 - rust-lang/rust#150064 (std: io: error: Add comment for UEFI unpacked repr use)

Failed merges:

 - rust-lang/rust#150044 (Avoid unhelpful suggestion when crate name is invalid)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: mgca: No HirId for DefId ICE: generics_of: unexpected node kind ConstArg(ConstArg

4 participants