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 // Test sized-ness checking in substitution.
15 fn f1<Sized? X>(x: &X) {
16 f2::<X>(x); //~ ERROR instantiating a type parameter with an incompatible type `X`, which does n
23 fn f3<Sized? X: T>(x: &X) {
24 f4::<X>(x); //~ ERROR instantiating a type parameter with an incompatible type `X`, which does n
29 // Test with unsized enum.
35 fn f6<Sized? X>(x: &X) {}
36 fn f7<Sized? X>(x1: &E<X>, x2: &E<X>) {
37 f5(x1); //~ERROR instantiating a type parameter with an incompatible type `E<X>`, which does not
42 // Test with unsized struct.
47 fn f8<Sized? X>(x1: &S<X>, x2: &S<X>) {
48 f5(x1); //~ERROR instantiating a type parameter with an incompatible type `S<X>`, which does not
53 fn f9<Sized? X>(x1: Box<S<X>>, x2: Box<E<X>>) {
54 f5(&(*x1, 34i)); //~ERROR instantiating a type parameter with an incompatible type `(S<X>,int)`,
55 f5(&(32i, *x2)); //~ERROR instantiating a type parameter with an incompatible type `(int,E<X>)`,
58 // I would like these to fail eventually.
64 impl<Sized? X: T> T1<X> for S3<X> { //ERROR instantiating a type parameter with an incompatible type
70 impl<Sized? X> T2<X> for S3<X> { //ERROR instantiating a type parameter with an incompatible type `X
77 impl<Sized? X> T3<X> for S4<X> { //~ ERROR instantiating a type parameter with an incompatible type