1 // revisions: base extended
3 #![feature(generic_associated_types)]
4 #![cfg_attr(extended, feature(generic_associated_types_extended))]
5 #![cfg_attr(extended, allow(incomplete_features))]
8 fn t(&'a self) -> &'a T;
11 impl<'a, T> RefCont<'a, T> for &'a T {
12 fn t(&'a self) -> &'a T {
17 impl<'a, T> RefCont<'a, T> for Box<T> {
18 fn t(&'a self) -> &'a T {
24 type VRefCont<'a>: RefCont<'a, V> where Self: 'a;
25 fn get<'a>(&'a self, key: &K) -> Option<Self::VRefCont<'a>>;
28 impl<K: Ord, V: 'static> MapLike<K, V> for std::collections::BTreeMap<K, V> {
29 type VRefCont<'a> = &'a V where Self: 'a;
30 fn get<'a>(&'a self, key: &K) -> Option<&'a V> {
31 std::collections::BTreeMap::get(self, key)
37 impl<K, V: Default> MapLike<K, V> for Source {
38 type VRefCont<'a> = Box<V>;
39 fn get<'a>(&self, _: &K) -> Option<Box<V>> {
40 Some(Box::new(V::default()))
45 let m = Box::new(std::collections::BTreeMap::<u8, u8>::new())
46 //[base]~^ ERROR the trait
47 //[extended]~^^ type mismatch
48 as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>;
49 //~^ ERROR missing generics for associated type
50 //[base]~^^ ERROR the trait