Skip to content

Conversation

@lapla-cogito
Copy link
Contributor

@lapla-cogito lapla-cogito commented Nov 24, 2025

fixes #142913

The ICE happened because const_param_default instantiated the default expression using the const parameter’s own identity arguments, which are empty. When the default’s type referenced earlier generics, the subsequent instantiate call saw parameters but no arguments and panicked. In this PR, supplying the slice of the parent’s generic arguments up to the parameter being defaulted prevents that mismatch.

@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 Nov 24, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 24, 2025

r? @fee1-dead

rustbot has assigned @fee1-dead.
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

@BoxyUwU
Copy link
Member

BoxyUwU commented Nov 24, 2025

r? BoxyUwU

@rustbot rustbot assigned BoxyUwU and unassigned fee1-dead Nov 24, 2025
@BoxyUwU
Copy link
Member

BoxyUwU commented Dec 3, 2025

In theory anonymous constants aren't supposed to work with generic_const_parameter_types because they aren't allowed to make use of generic parameters so can't actually construct a value of a type that references generics. Feeding a type of &'a Foo to the default would kinda be wrong 🤔

I think in lower_const_arg in ty lowering we try to detect feeding a type referencing generic parameters for an anon const and if so we error. I'm not sure why that's not happening. I would expect fixing whatever's going wrong there to also fix this ICE. Could you take a look into that for me?

@BoxyUwU
Copy link
Member

BoxyUwU commented Dec 3, 2025

@rustbot author

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

rustbot commented Dec 3, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

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

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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: region parameter out of range when instantiating args

4 participants