diff options
Diffstat (limited to 'tests/ui/traits/map-types.rs')
-rw-r--r-- | tests/ui/traits/map-types.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/traits/map-types.rs b/tests/ui/traits/map-types.rs new file mode 100644 index 000000000..dc33b9618 --- /dev/null +++ b/tests/ui/traits/map-types.rs @@ -0,0 +1,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 +} |