-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-lazy-normalizationArea: Lazy normalization (tracking issue: #60471)Area: Lazy normalization (tracking issue: #60471)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. GATsrequires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
Associated type constraint fails, even if it implements requested trait. In the example below, requested trait is Marker
, u32
implements it, <MyStruct as MyTrait>::Item<'a> == u32
, but <MyStruct as MyTrait>::Item<'a>: Marker
does not pass. (Everything is ok with <'a>
removed)
The code:
#![allow(incomplete_features)]
#![feature(generic_associated_types)]
trait Marker {}
impl Marker for u32 {}
trait MyTrait {
type Item<'a>;
}
struct MyStruct;
impl MyTrait for MyStruct {
type Item<'a> = u32;
}
fn ty_check<T>()
where
T: MyTrait,
for<'a> T::Item<'a>: Marker
{}
fn main() {
ty_check::<MyStruct>();
}
Meta
rustc --version --verbose
:
rustc 1.48.0-nightly (cdc8f0606 2020-09-05)
binary: rustc
commit-hash: cdc8f0606d0f3c4f3866643382c8a5776d1bdaed
commit-date: 2020-09-05
host: x86_64-unknown-linux-gnu
release: 1.48.0-nightly
LLVM version: 11.0
Metadata
Metadata
Assignees
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-lazy-normalizationArea: Lazy normalization (tracking issue: #60471)Area: Lazy normalization (tracking issue: #60471)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. GATsrequires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.