]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/map-types.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / test / compile-fail / map-types.rs
CommitLineData
223e47cc
LB
1// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
1a4d82fc
JJ
11#![feature(box_syntax)]
12
13extern crate collections;
14
15use std::collections::HashMap;
16
85aaf69f
SL
17trait Map<K, V>
18{
19 fn get(&self, k: K) -> V { panic!() }
20}
1a4d82fc
JJ
21
22impl<K, V> Map<K, V> for HashMap<K, V> {}
223e47cc
LB
23
24// Test that trait types printed in error msgs include the type arguments.
25
26fn main() {
1a4d82fc
JJ
27 let x: Box<HashMap<isize, isize>> = box HashMap::new();
28 let x: Box<Map<isize, isize>> = x;
c34b1796
AL
29 // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
30 let y: Box<Map<usize, isize>> = Box::new(x);
54a0048b 31 //~^ ERROR `Box<Map<isize, isize>>: Map<usize, isize>` is not satisfied
223e47cc 32}