-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Open
Labels
A-technical-debtArea: Internal cleanup workArea: Internal cleanup workC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.E-needs-designThis issue needs exploration and design to see how and if we can fix/implement itThis issue needs exploration and design to see how and if we can fix/implement itF-min_generic_const_args`#![feature(min_generic_const_args)]``#![feature(min_generic_const_args)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
In #150519 we added some checks to HIR ty lowering that when lowering to a generic parameter, we aren't inside of an anon const for const generics which shouldn't be able to use generic parameters.
There are a two main bits of follow up work here:
- The current impl is fairly brittle, it requires special casing all places that we're aware of as potentially introducing uses of generic parameters that shouldn't be allowed. We've previously got this wrong (Use more principled check for generics in const ops #150519). I don't know how likely it is that we've correctly checked all positions
- It only applies to anon consts from const generics. In theory it would be nice if we checked all generic parameters we find against the
generics_ofof the item we're inside of and asserted they are actually supposed to be nameable
I expect things to be quite perf sensitive here, and also it seems hard to get a good API here. cc @camelid
I've tagged this as F-min_generic_const_args as we rely quite heavily on this check for mGCA as we don't do any validation at name resolution time. But this logic is used on stable and it would be good to have these assertions on stable too
Metadata
Metadata
Labels
A-technical-debtArea: Internal cleanup workArea: Internal cleanup workC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.E-needs-designThis issue needs exploration and design to see how and if we can fix/implement itThis issue needs exploration and design to see how and if we can fix/implement itF-min_generic_const_args`#![feature(min_generic_const_args)]``#![feature(min_generic_const_args)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.