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