-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Defaulted const generic parameters no longer have the const arg's type checked #139643
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)C-bugCategory: This is a bug.Category: This is a bug.F-const_generics_defaults`#![feature(const_generics_defaults)]``#![feature(const_generics_defaults)]`P-lowLow priorityLow priorityT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Metadata
Metadata
Assignees
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)C-bugCategory: This is a bug.Category: This is a bug.F-const_generics_defaults`#![feature(const_generics_defaults)]``#![feature(const_generics_defaults)]`P-lowLow priorityLow priorityT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Code
I tried this code:
I expected to see this happen: It fail to compile like it uised to
Instead, this happened: it compile :>
Probably regressed in #125915 where we started lowering const arguments to
ConstArgKind::Pathinstead ofConstArgKind::Anonso there is no longer implicitly an anon const with an expected type ofu64with an expr typed asu32.We could probably special case handling of types of defaulted const generics in wfcheck to be done even when generics are involved. Or just accept this as working code which is consistent with things like
struct Foo<T, U = <T as Iterator>::Item>(T, U);🤷♀ would need a types fcp for that thoI don't believe this to be a soundness bug