]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/unsized5.rs
Register new snapshots
[rust.git] / src / test / compile-fail / unsized5.rs
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.
4 //
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.
10 #![feature(struct_variant)]
11
12 // Test `type` types not allowed in fields or local variables.
13
14 /*trait T for type {}
15
16 fn f5<type X>(x: &X) {
17     let _: X; // ERROR local variable with dynamically sized type X
18     let _: (int, (X, int)); // ERROR local variable with dynamically sized type (int,(X,int))
19 }
20 fn f6<type X: T>(x: &X) {
21     let _: X; // ERROR local variable with dynamically sized type X
22     let _: (int, (X, int)); // ERROR local variable with dynamically sized type (int,(X,int))
23 }*/
24
25 struct S1<type X> {
26     f1: X, //~ ERROR type `f1` is dynamically sized. dynamically sized types may only appear as the
27     f2: int,
28 }
29 struct S2<type X> {
30     f: int,
31     g: X, //~ ERROR type `g` is dynamically sized. dynamically sized types may only appear as the ty
32     h: int,
33 }
34
35 enum E<type X> {
36     V1(X, int), //~ERROR type `X` is dynamically sized. dynamically sized types may only appear as t
37     V2{f1: X, f: int}, //~ERROR type `f1` is dynamically sized. dynamically sized types may only app
38 }
39
40 pub fn main() {
41 }