]> git.proxmox.com Git - rustc.git/blob - src/test/auxiliary/issue13507.rs
22ccb3dfacdf1285912e6bbab1083ca38e17d73d
[rustc.git] / src / test / auxiliary / issue13507.rs
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
11 #![feature(core)]
12
13 pub mod testtypes {
14 use std::any::TypeId;
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
37 // Tests ty_bool
38 pub type FooBool = bool;
39
40 // Tests ty_char
41 pub type FooChar = char;
42
43 // Tests ty_int (does not test all variants of IntTy)
44 pub type FooInt = isize;
45
46 // Tests ty_uint (does not test all variants of UintTy)
47 pub type FooUint = usize;
48
49 // Tests ty_float (does not test all variants of FloatTy)
50 pub type FooFloat = f64;
51
52 // For ty_str, what kind of string should I use? &'static str? String? Raw str?
53
54 // Tests ty_enum
55 pub enum FooEnum {
56 VarA(usize),
57 VarB(usize, usize)
58 }
59
60 // Tests ty_uniq (of u8)
61 pub type FooUniq = Box<u8>;
62
63 // As with ty_str, what type should be used for ty_vec?
64
65 // Tests ty_ptr
66 pub type FooPtr = *const u8;
67
68 // Skipping ty_rptr
69
70 // Skipping ty_bare_fn (how do you get a bare function type, rather than proc or closure?)
71
72 // Tests ty_trait
73 pub trait FooTrait {
74 fn foo_method(&self) -> usize;
75 fn foo_static_method() -> usize;
76 }
77
78 // Tests ty_struct
79 pub struct FooStruct {
80 pub pub_foo_field: usize,
81 foo_field: usize
82 }
83
84 // Tests ty_tup
85 pub type FooTuple = (u8, i8, bool);
86
87 // Skipping ty_param
88
89 // Skipping ty_self
90
91 // Skipping ty_self
92
93 // Skipping ty_infer
94
95 // Skipping ty_err
96 }