Closed
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