]> git.proxmox.com Git - rustc.git/blame - src/test/auxiliary/issue13507.rs
Imported Upstream version 1.2.0+dfsg1
[rustc.git] / src / test / auxiliary / issue13507.rs
CommitLineData
1a4d82fc
JJ
1// Copyright 2012-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
c34b1796
AL
11#![feature(core)]
12
1a4d82fc 13pub mod testtypes {
85aaf69f 14 use std::any::TypeId;
1a4d82fc
JJ
15
16 pub fn type_ids() -> Vec<TypeId> {
17 let mut ids = vec!();
18 ids.push(TypeId::of::<FooNil>());
19 ids.push(TypeId::of::<FooBool>());
20 ids.push(TypeId::of::<FooInt>());
21 ids.push(TypeId::of::<FooUint>());
22 ids.push(TypeId::of::<FooFloat>());
23 ids.push(TypeId::of::<FooEnum>());
24 ids.push(TypeId::of::<FooUniq>());
25 ids.push(TypeId::of::<FooPtr>());
26 ids.push(TypeId::of::<&'static FooTrait>());
27 ids.push(TypeId::of::<FooStruct>());
28 ids.push(TypeId::of::<FooTuple>());
29 ids
30 }
31
32 // Tests ty_nil
33 pub type FooNil = ();
34
35 // Skipping ty_bot
36
62682a34 37 // Tests TyBool
1a4d82fc
JJ
38 pub type FooBool = bool;
39
62682a34 40 // Tests TyChar
1a4d82fc
JJ
41 pub type FooChar = char;
42
62682a34 43 // Tests TyInt (does not test all variants of IntTy)
c34b1796 44 pub type FooInt = isize;
1a4d82fc 45
62682a34 46 // Tests TyUint (does not test all variants of UintTy)
c34b1796 47 pub type FooUint = usize;
1a4d82fc 48
62682a34 49 // Tests TyFloat (does not test all variants of FloatTy)
1a4d82fc
JJ
50 pub type FooFloat = f64;
51
62682a34 52 // For TyStr, what kind of string should I use? &'static str? String? Raw str?
1a4d82fc 53
62682a34 54 // Tests TyEnum
1a4d82fc 55 pub enum FooEnum {
c34b1796
AL
56 VarA(usize),
57 VarB(usize, usize)
1a4d82fc
JJ
58 }
59
62682a34 60 // Tests TyBox (of u8)
1a4d82fc
JJ
61 pub type FooUniq = Box<u8>;
62
62682a34 63 // As with TyStr, what type should be used for TyArray?
1a4d82fc 64
62682a34 65 // Tests TyRawPtr
1a4d82fc
JJ
66 pub type FooPtr = *const u8;
67
62682a34 68 // Skipping TyRef
1a4d82fc 69
62682a34 70 // Skipping TyBareFn (how do you get a bare function type, rather than proc or closure?)
1a4d82fc 71
62682a34 72 // Tests TyTrait
1a4d82fc 73 pub trait FooTrait {
c34b1796
AL
74 fn foo_method(&self) -> usize;
75 fn foo_static_method() -> usize;
1a4d82fc
JJ
76 }
77
62682a34 78 // Tests TyStruct
1a4d82fc 79 pub struct FooStruct {
c34b1796
AL
80 pub pub_foo_field: usize,
81 foo_field: usize
1a4d82fc
JJ
82 }
83
62682a34 84 // Tests TyTuple
1a4d82fc
JJ
85 pub type FooTuple = (u8, i8, bool);
86
87 // Skipping ty_param
88
89 // Skipping ty_self
90
91 // Skipping ty_self
92
62682a34 93 // Skipping TyInfer
1a4d82fc 94
62682a34 95 // Skipping TyError
1a4d82fc 96}