- Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)C-bugCategory: This is a bug.Category: This is a bug.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATs`#![feature(generic_associated_types)]` a.k.a. GATsP-mediumMedium priorityMedium priority
Description
I tried this code: playground
#![feature(generic_associated_types)] #![allow(invalid_type_param_default)] trait Trait { type Assoc<T = u32>; } impl Trait for () { type Assoc<T = u32> = u64; } impl Trait for u32 { type Assoc<T = u32> = T; } trait Other {} impl Other for u32 {} fn foo<T>() where T: Trait<Assoc = u32>, T::Assoc: Other { } fn main() { // errors foo::<()>(); // works foo::<u32>(); }
I expected to see this happen: It not work correctly as if you remove #![allow(invalid_type_param_default)]
it shouts at you saying its unsupported and will be a hard error one day.
Instead, this happened: defaults on GATs seem to function perfectly fine
Meta
version from playground:
1.64.0-nightly (2022-07-12 1c7b36d4db582cb47513)
cc @jackh726 this is probably should either be allowed or a hard error before stabilisation?
schneiderfelipe
Metadata
Metadata
Assignees
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)C-bugCategory: This is a bug.Category: This is a bug.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATs`#![feature(generic_associated_types)]` a.k.a. GATsP-mediumMedium priorityMedium priority