minor Type::opaque_trait code cleanup

This commit is contained in:
U-NOV2010\eugals 2013-09-17 13:36:47 +04:00 committed by Evgeny Sologubov
parent 2927ab13df
commit dfa3f5fa8d
1 changed files with 6 additions and 17 deletions

View File

@ -278,23 +278,12 @@ impl Type {
pub fn opaque_trait(ctx: &CrateContext, store: ty::TraitStore) -> Type {
let tydesc_ptr = ctx.tydesc_type.ptr_to();
match store {
ty::BoxTraitStore => {
Type::struct_(
[ tydesc_ptr, Type::opaque_box(ctx).ptr_to() ],
false)
}
ty::UniqTraitStore => {
Type::struct_(
[ tydesc_ptr, Type::unique(ctx, &Type::i8()).ptr_to()],
false)
}
ty::RegionTraitStore(*) => {
Type::struct_(
[ tydesc_ptr, Type::i8().ptr_to() ],
false)
}
}
let box_ty = match store {
ty::BoxTraitStore => Type::opaque_box(ctx),
ty::UniqTraitStore => Type::unique(ctx, &Type::i8()),
ty::RegionTraitStore(*) => Type::i8()
};
Type::struct_([tydesc_ptr, box_ty.ptr_to()], false)
}
pub fn kind(&self) -> TypeKind {