summaryrefslogtreecommitdiffstats
path: root/src/test/ui/traits/map-types.rs
blob: dc33b961800ea8bf75bc8ecef9780493ab95a9da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use std::collections::HashMap;



trait Map<K, V>
{
    fn get(&self, k: K) -> V { panic!() }
}

impl<K, V> Map<K, V> for HashMap<K, V> {}

// Test that trait types printed in error msgs include the type arguments.

fn main() {
    let x: Box<HashMap<isize, isize>> = HashMap::new().into();
    let x: Box<dyn Map<isize, isize>> = x;
    let y: Box<dyn Map<usize, isize>> = Box::new(x);
    //~^ ERROR `Box<dyn Map<isize, isize>>: Map<usize, isize>` is not satisfied
}