]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/issues/issue-20616.rs
New upstream version 1.31.0~beta.4+dfsg1
[rustc.git] / src / test / run-pass / issues / 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 // run-pass
12 #![allow(dead_code)]
13 type MyType<'a, T> = &'a T;
14
15 // combine lifetime bounds and type arguments in usual way
16 type TypeA<'a> = MyType<'a, ()>;
17
18 // ensure token `>>` works fine
19 type TypeB = Box<TypeA<'static>>;
20 type TypeB_ = Box<TypeA<'static,>>;
21
22 // trailing comma when combine lifetime bounds and type arguments
23 type TypeC<'a> = MyType<'a, (),>;
24
25 // normal lifetime bounds
26 type TypeD = TypeA<'static>;
27
28 // trailing comma on lifetime bounds
29 type TypeE = TypeA<'static,>;
30
31 // normal type argument
32 type TypeF<T> = Box<T>;
33
34 // type argument with trailing comma
35 type TypeG<T> = Box<T,>;
36
37 // trailing comma on lifetime defs
38 type TypeH<'a,> = &'a ();
39
40 // trailing comma on type argument
41 type TypeI<T,> = T;
42
43 static STATIC: () = ();
44
45 fn main() {
46
47 // ensure token `>=` works fine
48 let _: TypeA<'static>= &STATIC;
49 let _: TypeA<'static,>= &STATIC;
50
51 // ensure token `>>=` works fine
52 let _: Box<TypeA<'static>>= Box::new(&STATIC);
53 let _: Box<TypeA<'static,>>= Box::new(&STATIC);
54 }