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` local variables.
16 fn f1<X: ?Sized>(x: &X) {
17 let _: X; // <-- this is OK, no bindings created, no initializer.
18 let _: (isize, (X, isize)); // same
19 let y: X; //~ERROR the trait `core::marker::Sized` is not implemented
20 let y: (isize, (X, isize)); //~ERROR the trait `core::marker::Sized` is not implemented
22 fn f2<X: ?Sized + T>(x: &X) {
23 let y: X; //~ERROR the trait `core::marker::Sized` is not implemented
24 let y: (isize, (X, isize)); //~ERROR the trait `core::marker::Sized` is not implemented
27 fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
28 let y: X = *x1; //~ERROR the trait `core::marker::Sized` is not implemented
29 let y = *x2; //~ERROR the trait `core::marker::Sized` is not implemented
30 let (y, z) = (*x3, 4); //~ERROR the trait `core::marker::Sized` is not implemented
32 fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
33 let y: X = *x1; //~ERROR the trait `core::marker::Sized` is not implemented
34 let y = *x2; //~ERROR the trait `core::marker::Sized` is not implemented
35 let (y, z) = (*x3, 4); //~ERROR the trait `core::marker::Sized` is not implemented
38 fn g1<X: ?Sized>(x: X) {} //~ERROR the trait `core::marker::Sized` is not implemented
39 fn g2<X: ?Sized + T>(x: X) {} //~ERROR the trait `core::marker::Sized` is not implemented