]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/issue-20616.rs
Auto merge of #28816 - petrochenkov:unistruct, r=nrc
[rust.git] / src / test / run-pass / issue-20616.rs
1 // Copyright 2015 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
11 type MyType<'a, T> = &'a T;
12
13 // combine lifetime bounds and type arguments in usual way
14 type TypeA<'a> = MyType<'a, ()>;
15
16 // ensure token `>>` works fine
17 type TypeB = Box<TypeA<'static>>;
18 type TypeB_ = Box<TypeA<'static,>>;
19
20 // trailing comma when combine lifetime bounds and type arguments
21 type TypeC<'a> = MyType<'a, (),>;
22
23 // normal lifetime bounds
24 type TypeD = TypeA<'static>;
25
26 // trailing comma on lifetime bounds
27 type TypeE = TypeA<'static,>;
28
29 // normal type arugment
30 type TypeF<T> = Box<T>;
31
32 // type argument with trailing comma
33 type TypeG<T> = Box<T,>;
34
35 // trailing comma on lifetime defs
36 type TypeH<'a,> = &'a ();
37
38 // trailing comma on type argument
39 type TypeI<T,> = T;
40
41 static STATIC: () = ();
42
43 fn main() {
44
45     // ensure token `>=` works fine
46     let _: TypeA<'static>= &STATIC;
47     let _: TypeA<'static,>= &STATIC;
48
49     // ensure token `>>=` works fine
50     let _: Box<TypeA<'static>>= Box::new(&STATIC);
51     let _: Box<TypeA<'static,>>= Box::new(&STATIC);
52 }