]> git.proxmox.com Git - rustc.git/blame - src/test/auxiliary/issue13507.rs
Imported Upstream version 1.9.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> {
54a0048b
SL
17 vec![
18 TypeId::of::<FooBool>(),
19 TypeId::of::<FooInt>(),
20 TypeId::of::<FooUint>(),
21 TypeId::of::<FooFloat>(),
22 TypeId::of::<FooStr>(),
23 TypeId::of::<FooArray>(),
24 TypeId::of::<FooSlice>(),
25 TypeId::of::<FooBox>(),
26 TypeId::of::<FooPtr>(),
27 TypeId::of::<FooRef>(),
28 TypeId::of::<FooFnPtr>(),
29 TypeId::of::<FooNil>(),
30 TypeId::of::<FooTuple>(),
31 TypeId::of::<FooTrait>(),
32 TypeId::of::<FooStruct>(),
33 TypeId::of::<FooEnum>()
34 ]
1a4d82fc
JJ
35 }
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
54a0048b
SL
52 // Tests TyStr
53 pub type FooStr = str;
1a4d82fc 54
54a0048b
SL
55 // Tests TyArray
56 pub type FooArray = [u8; 1];
1a4d82fc 57
54a0048b
SL
58 // Tests TySlice
59 pub type FooSlice = [u8];
1a4d82fc 60
54a0048b
SL
61 // Tests TyBox (of u8)
62 pub type FooBox = Box<u8>;
1a4d82fc 63
62682a34 64 // Tests TyRawPtr
1a4d82fc
JJ
65 pub type FooPtr = *const u8;
66
54a0048b
SL
67 // Tests TyRef
68 pub type FooRef = &'static u8;
1a4d82fc 69
54a0048b
SL
70 // Tests TyFnPtr
71 pub type FooFnPtr = fn(u8) -> bool;
1a4d82fc 72
62682a34 73 // Tests TyTrait
1a4d82fc 74 pub trait FooTrait {
c34b1796 75 fn foo_method(&self) -> 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
54a0048b
SL
84 // Tests TyEnum
85 pub enum FooEnum {
86 VarA(usize),
87 VarB(usize, usize)
88 }
89
62682a34 90 // Tests TyTuple
54a0048b 91 pub type FooNil = ();
1a4d82fc
JJ
92 pub type FooTuple = (u8, i8, bool);
93
54a0048b 94 // Skipping TyParam
1a4d82fc 95
62682a34 96 // Skipping TyInfer
1a4d82fc 97
62682a34 98 // Skipping TyError
1a4d82fc 99}