Skip to content

Commit f698c67

Browse files
committed
---
yaml --- r: 140423 b: refs/heads/try2 c: db6a62c h: refs/heads/master i: 140421: 0716ce9 140419: aa8a5fb 140415: a96adde v: v3
1 parent ac0604f commit f698c67

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 9847428acf91e313c9c742fc38c69546bcfc8b26
8+
refs/heads/try2: db6a62c537852a30f030f866598c358d01fb95cd
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/trans/glue.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,15 @@ pub fn call_tydesc_glue(cx: block, v: ValueRef, t: ty::t, field: uint)
394394

395395
pub fn make_visit_glue(bcx: block, v: ValueRef, t: ty::t) {
396396
let _icx = bcx.insn_ctxt("make_visit_glue");
397-
let mut bcx = bcx;
398-
let (visitor_trait, object_ty) = ty::visitor_object_ty(bcx.tcx());
399-
let v = PointerCast(bcx, v, T_ptr(type_of::type_of(bcx.ccx(), object_ty)));
400-
bcx = reflect::emit_calls_to_trait_visit_ty(bcx, t, v, visitor_trait.def_id);
397+
let bcx = do with_scope(bcx, None, ~"visitor cleanup") |bcx| {
398+
let mut bcx = bcx;
399+
let (visitor_trait, object_ty) = ty::visitor_object_ty(bcx.tcx());
400+
let v = PointerCast(bcx, v, T_ptr(type_of::type_of(bcx.ccx(), object_ty)));
401+
bcx = reflect::emit_calls_to_trait_visit_ty(bcx, t, v, visitor_trait.def_id);
402+
// The visitor is a boxed object and needs to be dropped
403+
add_clean(bcx, v, object_ty);
404+
bcx
405+
};
401406
build_return(bcx);
402407
}
403408

0 commit comments

Comments
 (0)