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.
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.
12 use std::intrinsics::TypeId;
14 pub fn type_ids() -> Vec<TypeId> {
16 ids.push(TypeId::of::<FooNil>());
17 ids.push(TypeId::of::<FooBool>());
18 ids.push(TypeId::of::<FooInt>());
19 ids.push(TypeId::of::<FooUint>());
20 ids.push(TypeId::of::<FooFloat>());
21 ids.push(TypeId::of::<FooEnum>());
22 ids.push(TypeId::of::<FooUniq>());
23 ids.push(TypeId::of::<FooPtr>());
24 ids.push(TypeId::of::<FooClosure>());
25 ids.push(TypeId::of::<&'static FooTrait>());
26 ids.push(TypeId::of::<FooStruct>());
27 ids.push(TypeId::of::<FooTuple>());
37 pub type FooBool = bool;
40 pub type FooChar = char;
42 // Tests ty_int (does not test all variants of IntTy)
43 pub type FooInt = int;
45 // Tests ty_uint (does not test all variants of UintTy)
46 pub type FooUint = uint;
48 // Tests ty_float (does not test all variants of FloatTy)
49 pub type FooFloat = f64;
51 // For ty_str, what kind of string should I use? &'static str? ~str? Raw str?
61 // Tests ty_uniq (of u8)
62 pub type FooUniq = ~u8;
64 // As with ty_str, what type should be used for ty_vec?
67 pub type FooPtr = *u8;
71 // Skipping ty_bare_fn (how do you get a bare function type, rather than proc or closure?)
73 // Tests ty_closure (does not test all types of closures)
74 pub type FooClosure = |arg: u8|: 'static -> u8;
78 fn foo_method(&self) -> uint;
79 fn foo_static_method() -> uint;
83 pub struct FooStruct {
84 pub pub_foo_field: uint,
89 pub type FooTuple = (u8, i8, bool);