// revisions: base extended #![cfg_attr(extended, feature(generic_associated_types_extended))] #![cfg_attr(extended, allow(incomplete_features))] trait RefCont<'a, T> { fn t(&'a self) -> &'a T; } impl<'a, T> RefCont<'a, T> for &'a T { fn t(&'a self) -> &'a T { self } } impl<'a, T> RefCont<'a, T> for Box { fn t(&'a self) -> &'a T { self.as_ref() } } trait MapLike { type VRefCont<'a>: RefCont<'a, V> where Self: 'a; fn get<'a>(&'a self, key: &K) -> Option>; } impl MapLike for std::collections::BTreeMap { type VRefCont<'a> = &'a V where Self: 'a; fn get<'a>(&'a self, key: &K) -> Option<&'a V> { std::collections::BTreeMap::get(self, key) } } struct Source; impl MapLike for Source { type VRefCont<'a> = Box; fn get<'a>(&self, _: &K) -> Option> { Some(Box::new(V::default())) } } fn main() { let m = Box::new(std::collections::BTreeMap::::new()) //[base]~^ ERROR the trait //[extended]~^^ type mismatch as Box>>; //~^ ERROR missing generics for associated type //[base]~^^ ERROR the trait }