Skip to content

Forbid generic parameters in the type of const generic parameters #74152

Closed
@lcnr

Description

@lcnr

e.g. do not allow fn foo<T, const N: T>() and foo<const N: usize, const M: [u8; N]>().

While we may want to support this in the future, this should not be part of the MVP and causes a lot of problems
with our current approach. It causes both ICE ICE baby and breaks foo<const N: [u8; { 1+ 4 }]>() because { 1 + 4 } contains N itself in its substitutions.

What probably has to done here:

  • change name resolution to forbid mentions of parameters.
  • stop using the parent generics in generics_of.

cc @eddyb @varkor @yodaldevoid

Metadata

Metadata

Assignees

Labels

A-const-genericsArea: const generics (parameters and arguments)A-lazy-normalizationArea: Lazy normalization (tracking issue: #60471)C-enhancementCategory: An issue proposing an enhancement or a PR with one.F-const_generics`#![feature(const_generics)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions