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(box_syntax)]
13 // Test sized-ness checking in substitution.
18 fn f1<X: ?Sized>(x: &X) {
27 trait T { fn dummy(&self) { } }
28 fn f3<X: T+?Sized>(x: &X) {
46 fn f5<X: ?Sized+T2>(x: &X) {
47 let _: Box<X> = T2::f();
50 let _: Box<X> = T2::f();
61 fn f7<X: ?Sized+T3>(x: &X) {
62 // This is valid, but the unsized bound on X is irrelevant because any type
63 // which implements T3 must have statically known size.
64 let _: Box<X> = T3::f();
69 fn m1(&self, x: &T4<X>, y: X);
70 fn m2(&self, x: &T5<X>, y: X);
74 // not an error (for now)
75 fn m1(&self, x: &T4<X>);
76 fn m2(&self, x: &T5<X>);
81 fn m1(&self, x: &T4<X>);
82 fn m2(&self, x: &T5<X>);
84 trait T7<X: ?Sized+T> {
86 // not an error (for now)
87 fn m1(&self, x: &T4<X>);
88 fn m2(&self, x: &T5<X>);
91 // The last field in a struct may be unsized
92 struct S2<X: ?Sized> {
95 struct S3<X: ?Sized> {