]>
git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/specialization/specialization-default-projection.rs
1 // Copyright 2015 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(specialization)]
13 // Make sure we can't project defaulted associated types
20 default type Assoc
= ();
27 fn generic
<T
>() -> <T
as Foo
>::Assoc
{
28 // `T` could be some downstream crate type that specializes (or,
29 // for that matter, `u8`).
31 () //~ ERROR mismatched types
34 fn monomorphic() -> () {
35 // Even though we know that `()` is not specialized in a
36 // downstream crate, typeck refuses to project here.
38 generic
::<()>() //~ ERROR mismatched types
42 // No error here, we CAN project from `u8`, as there is no `default`
44 let s
: String
= generic
::<u8>();
45 println
!("{}", s
); // bad news if this all compiles