1 // Copyright 2014 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.
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.
11 #![feature(default_type_params)]
16 struct Foo<T = A, U = B, V = C>;
19 struct HashMap<K, V, H = Hash<K>>;
22 // Ensure that the printed type doesn't include the default type params...
24 //~^ ERROR mismatched types: expected `Foo<int>` but found `()`
26 // ...even when they're present, but the same types as the defaults.
27 let _: Foo<int, B, C> = ();
28 //~^ ERROR mismatched types: expected `Foo<int>` but found `()`
30 // Including cases where the default is using previous type params.
31 let _: HashMap<String, int> = ();
32 //~^ ERROR mismatched types: expected `HashMap<std::string::String,int>` but found `()`
33 let _: HashMap<String, int, Hash<String>> = ();
34 //~^ ERROR mismatched types: expected `HashMap<std::string::String,int>` but found `()`
36 // But not when there's a different type in between.
37 let _: Foo<A, int, C> = ();
38 //~^ ERROR mismatched types: expected `Foo<A,int>` but found `()`
40 // And don't print <> at all when there's just defaults.
41 let _: Foo<A, B, C> = ();
42 //~^ ERROR mismatched types: expected `Foo` but found `()`