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 #![allow(unknown_features)]
12 #![feature(box_syntax)]
14 // Test sized-ness checking in substitution.
19 fn f1<X: ?Sized>(x: &X) {
28 trait T { fn dummy(&self) { } }
29 fn f3<X: T+?Sized>(x: &X) {
47 fn f5<X: ?Sized+T2>(x: &X) {
48 let _: Box<X> = T2::f();
51 let _: Box<X> = T2::f();
62 fn f7<X: ?Sized+T3>(x: &X) {
63 // This is valid, but the unsized bound on X is irrelevant because any type
64 // which implements T3 must have statically known size.
65 let _: Box<X> = T3::f();
70 fn m1(&self, x: &T4<X>, y: X);
71 fn m2(&self, x: &T5<X>, y: X);
75 // not an error (for now)
76 fn m1(&self, x: &T4<X>);
77 fn m2(&self, x: &T5<X>);
82 fn m1(&self, x: &T4<X>);
83 fn m2(&self, x: &T5<X>);
85 trait T7<X: ?Sized+T> {
87 // not an error (for now)
88 fn m1(&self, x: &T4<X>);
89 fn m2(&self, x: &T5<X>);
92 // The last field in a struct or variant may be unsized
93 struct S2<X: ?Sized> {
96 struct S3<X: ?Sized> {