2016-04-26 17:51:14 +00:00
|
|
|
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
pub mod testtypes {
|
|
|
|
use std::any::TypeId;
|
|
|
|
|
|
|
|
pub fn type_ids() -> Vec<TypeId> {
|
|
|
|
vec![
|
|
|
|
TypeId::of::<FooBool>(),
|
|
|
|
TypeId::of::<FooInt>(),
|
|
|
|
TypeId::of::<FooUint>(),
|
|
|
|
TypeId::of::<FooFloat>(),
|
|
|
|
TypeId::of::<FooStr>(),
|
|
|
|
TypeId::of::<FooArray>(),
|
|
|
|
TypeId::of::<FooSlice>(),
|
|
|
|
TypeId::of::<FooBox>(),
|
|
|
|
TypeId::of::<FooPtr>(),
|
|
|
|
TypeId::of::<FooRef>(),
|
|
|
|
TypeId::of::<FooFnPtr>(),
|
|
|
|
TypeId::of::<FooNil>(),
|
|
|
|
TypeId::of::<FooTuple>(),
|
|
|
|
TypeId::of::<FooTrait>(),
|
|
|
|
TypeId::of::<FooStruct>(),
|
|
|
|
TypeId::of::<FooEnum>()
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tests TyBool
|
|
|
|
pub type FooBool = bool;
|
|
|
|
|
|
|
|
// Tests TyChar
|
|
|
|
pub type FooChar = char;
|
|
|
|
|
|
|
|
// Tests TyInt (does not test all variants of IntTy)
|
|
|
|
pub type FooInt = isize;
|
|
|
|
|
|
|
|
// Tests TyUint (does not test all variants of UintTy)
|
|
|
|
pub type FooUint = usize;
|
|
|
|
|
|
|
|
// Tests TyFloat (does not test all variants of FloatTy)
|
|
|
|
pub type FooFloat = f64;
|
|
|
|
|
|
|
|
// Tests TyStr
|
|
|
|
pub type FooStr = str;
|
|
|
|
|
2018-08-22 00:35:02 +00:00
|
|
|
// Tests Array
|
2016-04-26 17:51:14 +00:00
|
|
|
pub type FooArray = [u8; 1];
|
|
|
|
|
2018-08-22 00:35:02 +00:00
|
|
|
// Tests Slice
|
2016-04-26 17:51:14 +00:00
|
|
|
pub type FooSlice = [u8];
|
|
|
|
|
2017-01-21 14:40:31 +00:00
|
|
|
// Tests Box (of u8)
|
2016-04-26 17:51:14 +00:00
|
|
|
pub type FooBox = Box<u8>;
|
|
|
|
|
2018-08-22 00:35:02 +00:00
|
|
|
// Tests RawPtr
|
2016-04-26 17:51:14 +00:00
|
|
|
pub type FooPtr = *const u8;
|
|
|
|
|
2018-08-22 00:35:02 +00:00
|
|
|
// Tests Ref
|
2016-04-26 17:51:14 +00:00
|
|
|
pub type FooRef = &'static u8;
|
|
|
|
|
2018-08-22 00:35:02 +00:00
|
|
|
// Tests FnPtr
|
2016-04-26 17:51:14 +00:00
|
|
|
pub type FooFnPtr = fn(u8) -> bool;
|
|
|
|
|
2018-08-22 00:35:02 +00:00
|
|
|
// Tests Dynamic
|
2016-04-26 17:51:14 +00:00
|
|
|
pub trait FooTrait {
|
|
|
|
fn foo_method(&self) -> usize;
|
|
|
|
}
|
|
|
|
|
2016-09-05 22:26:02 +00:00
|
|
|
// Tests struct
|
2016-04-26 17:51:14 +00:00
|
|
|
pub struct FooStruct {
|
|
|
|
pub pub_foo_field: usize,
|
|
|
|
foo_field: usize
|
|
|
|
}
|
|
|
|
|
2016-09-05 22:26:02 +00:00
|
|
|
// Tests enum
|
2016-04-26 17:51:14 +00:00
|
|
|
pub enum FooEnum {
|
|
|
|
VarA(usize),
|
|
|
|
VarB(usize, usize)
|
|
|
|
}
|
|
|
|
|
2018-08-22 00:35:02 +00:00
|
|
|
// Tests Tuple
|
2016-04-26 17:51:14 +00:00
|
|
|
pub type FooNil = ();
|
|
|
|
pub type FooTuple = (u8, i8, bool);
|
|
|
|
|
|
|
|
// Skipping TyParam
|
|
|
|
|
2018-08-22 00:35:02 +00:00
|
|
|
// Skipping Infer
|
2016-04-26 17:51:14 +00:00
|
|
|
|
2018-08-22 00:35:02 +00:00
|
|
|
// Skipping Error
|
2016-04-26 17:51:14 +00:00
|
|
|
}
|