mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
minor Type::opaque_trait code cleanup
This commit is contained in:
parent
2927ab13df
commit
dfa3f5fa8d
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user