We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 50bee30 commit 383e3fdCopy full SHA for 383e3fd
src/librustc/middle/trans/glue.rs
@@ -367,17 +367,9 @@ fn make_drop_glue<'a>(bcx: &'a Block<'a>, v0: ValueRef, t: ty::t) -> &'a Block<'
367
let lluniquevalue = GEPi(bcx, v0, [0, abi::trt_field_box]);
368
// Only drop the value when it is non-null
369
with_cond(bcx, IsNotNull(bcx, Load(bcx, lluniquevalue)), |bcx| {
370
- let llvtable = Load(bcx, GEPi(bcx, v0, [0, abi::trt_field_vtable]));
371
-
372
- // Cast the vtable to a pointer to a pointer to a tydesc.
373
- let llvtable = PointerCast(bcx, llvtable,
374
- ccx.tydesc_type.ptr_to().ptr_to());
375
- let lltydesc = Load(bcx, llvtable);
376
- call_tydesc_glue_full(bcx,
377
- lluniquevalue,
378
- lltydesc,
379
- abi::tydesc_field_drop_glue,
380
- None);
+ let lldtor_ptr = Load(bcx, GEPi(bcx, v0, [0, abi::trt_field_vtable]));
+ let lldtor = Load(bcx, lldtor_ptr);
+ Call(bcx, lldtor, [PointerCast(bcx, lluniquevalue, Type::i8p())], []);
381
bcx
382
})
383
}
src/librustc/middle/trans/meth.rs
@@ -498,7 +498,7 @@ pub fn make_vtable(ccx: &CrateContext,
498
unsafe {
499
let _icx = push_ctxt("meth::make_vtable");
500
501
- let mut components = ~[ tydesc.tydesc ];
+ let mut components = ~[tydesc.drop_glue.get().unwrap()];
502
for &ptr in ptrs.iter() {
503
components.push(ptr)
504
src/librustc/middle/trans/type_.rs
@@ -180,7 +180,7 @@ impl Type {
180
181
182
pub fn vtable() -> Type {
183
- Type::array(&Type::i8().ptr_to(), 1)
+ Type::array(&Type::i8p().ptr_to(), 1)
184
185
186
pub fn generic_glue_fn(cx: &CrateContext) -> Type {
@@ -246,13 +246,13 @@ impl Type {
246
247
248
pub fn opaque_trait(ctx: &CrateContext, store: ty::TraitStore) -> Type {
249
- let tydesc_ptr = ctx.tydesc_type.ptr_to();
+ let vtable = Type::glue_fn(Type::i8p()).ptr_to().ptr_to();
250
let box_ty = match store {
251
ty::BoxTraitStore => Type::at_box(ctx, Type::i8()),
252
ty::UniqTraitStore => Type::i8(),
253
ty::RegionTraitStore(..) => Type::i8()
254
};
255
- Type::struct_([tydesc_ptr, box_ty.ptr_to()], false)
+ Type::struct_([vtable, box_ty.ptr_to()], false)
256
257
258
pub fn kind(&self) -> TypeKind {
0 commit comments