-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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.
Description
Code
I tried this code:
struct Foo<const N: u32, const M: u64 = N>;
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::Path
instead of ConstArgKind::Anon
so there is no longer implicitly an anon const with an expected type of u64
with an expr typed as u32
.
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 tho
I don't believe this to be a soundness bug
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.