Skip to content

Commit 6f1770a

Browse files
U-NOV2010\eugalsEvgeny Sologubov
authored andcommitted
---
yaml --- r: 83247 b: refs/heads/try c: 0c3b6ad h: refs/heads/master i: 83245: fa45c79 83243: 74297a8 83239: 722cff4 83231: f8a293d v: v3
1 parent bd51c48 commit 6f1770a

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
5-
refs/heads/try: dfa3f5fa8d20bc970843c88bc5cbca398a26ce7c
5+
refs/heads/try: 0c3b6ad6b8c196b996e366aaf864db9e23767f0f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/middle/trans/expr.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ pub fn trans_to_datum(bcx: @mut Block, expr: @ast::Expr) -> DatumBlock {
343343
_ => {}
344344
}
345345

346-
347346
let scratch = scratch_datum(bcx, target_obj_ty,
348347
"__auto_borrow_obj", false);
349348

branches/try/src/librustc/middle/trans/meth.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,22 @@ pub fn trans_trait_callee(bcx: @mut Block,
434434
let _icx = push_ctxt("impl::trans_trait_callee");
435435
let mut bcx = bcx;
436436

437+
// make a local copy for trait if needed
437438
let self_ty = expr_ty_adjusted(bcx, self_expr);
438-
let self_scratch = scratch_datum(bcx, self_ty, "__trait_callee", false);
439-
bcx = expr::trans_into(bcx, self_expr, expr::SaveIn(self_scratch.val));
439+
let self_scratch = match ty::get(self_ty).sty {
440+
ty::ty_trait(_, _, ty::RegionTraitStore(*), _, _) => {
441+
unpack_datum!(bcx, expr::trans_to_datum(bcx, self_expr))
442+
}
443+
_ => {
444+
let d = scratch_datum(bcx, self_ty, "__trait_callee", false);
445+
bcx = expr::trans_into(bcx, self_expr, expr::SaveIn(d.val));
446+
// Arrange a temporary cleanup for the object in case something
447+
// should go wrong before the method is actually *invoked*.
448+
d.add_clean(bcx);
449+
d
450+
}
451+
};
440452

441-
// Arrange a temporary cleanup for the object in case something
442-
// should go wrong before the method is actually *invoked*.
443-
self_scratch.add_clean(bcx);
444453

445454
let callee_ty = node_id_type(bcx, callee_id);
446455
trans_trait_callee_from_llval(bcx,

0 commit comments

Comments
 (0)