Skip to content

Commit dcd8490

Browse files
committed
Remove TrByImplicitRef and source field on datums
1 parent 682afca commit dcd8490

File tree

7 files changed

+86
-115
lines changed

7 files changed

+86
-115
lines changed

src/librustc/middle/trans/_match.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ pub fn variant_opt(bcx: block, pat_id: ast::node_id)
314314
pub enum TransBindingMode {
315315
TrByValue(/*ismove:*/ bool, /*llbinding:*/ ValueRef),
316316
TrByRef,
317-
TrByImplicitRef
318317
}
319318

320319
/**
@@ -881,7 +880,7 @@ fn match_datum(bcx: block, val: ValueRef, pat_id: ast::node_id) -> Datum {
881880
//! we should just pass around a Datum and be done with it.
882881
883882
let ty = node_id_type(bcx, pat_id);
884-
Datum {val: val, ty: ty, mode: datum::ByRef, source: RevokeClean}
883+
Datum {val: val, ty: ty, mode: datum::ByRef(RevokeClean)}
885884
}
886885

887886

@@ -988,7 +987,7 @@ pub fn root_pats_as_necessary(mut bcx: block,
988987
let pat_id = br.pats[col].id;
989988
if pat_id != 0 {
990989
let datum = Datum {val: val, ty: node_id_type(bcx, pat_id),
991-
mode: ByRef, source: ZeroMem};
990+
mode: ByRef(ZeroMem)};
992991
bcx = datum.root_and_write_guard(bcx, br.pats[col].span, pat_id, 0);
993992
}
994993
}
@@ -1146,7 +1145,7 @@ pub fn store_non_ref_bindings(bcx: block,
11461145
TrByValue(is_move, lldest) => {
11471146
let llval = Load(bcx, binding_info.llmatch); // get a T*
11481147
let datum = Datum {val: llval, ty: binding_info.ty,
1149-
mode: ByRef, source: ZeroMem};
1148+
mode: ByRef(ZeroMem)};
11501149
bcx = {
11511150
if is_move {
11521151
datum.move_to(bcx, INIT, lldest)
@@ -1161,7 +1160,7 @@ pub fn store_non_ref_bindings(bcx: block,
11611160
temp_cleanups
11621161
}
11631162
}
1164-
TrByRef | TrByImplicitRef => {}
1163+
TrByRef => {}
11651164
}
11661165
}
11671166
return bcx;
@@ -1192,13 +1191,6 @@ pub fn insert_lllocals(bcx: block,
11921191
TrByRef => {
11931192
binding_info.llmatch
11941193
}
1195-
1196-
// Ugly: for implicit ref, we actually want a T*, but
1197-
// we have a T**, so we had to load. This will go away
1198-
// once implicit refs go away.
1199-
TrByImplicitRef => {
1200-
Load(bcx, binding_info.llmatch)
1201-
}
12021194
};
12031195

12041196
bcx.fcx.lllocals.insert(binding_info.id,
@@ -1254,7 +1246,7 @@ pub fn compile_guard(bcx: block,
12541246
TrByValue(_, llval) => {
12551247
bcx = glue::drop_ty(bcx, llval, binding_info.ty);
12561248
}
1257-
TrByRef | TrByImplicitRef => {}
1249+
TrByRef => {}
12581250
}
12591251
bcx.fcx.lllocals.remove(&binding_info.id);
12601252
}
@@ -1757,7 +1749,7 @@ pub fn bind_irrefutable_pat(bcx: block,
17571749
if make_copy {
17581750
let binding_ty = node_id_type(bcx, pat.id);
17591751
let datum = Datum {val: val, ty: binding_ty,
1760-
mode: ByRef, source: RevokeClean};
1752+
mode: ByRef(RevokeClean)};
17611753
let scratch = scratch_datum(bcx, binding_ty, false);
17621754
datum.copy_to_datum(bcx, INIT, scratch);
17631755
match binding_mode {

src/librustc/middle/trans/callee.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,7 @@ pub fn trans_arg_expr(bcx: block,
711711
DatumBlock {bcx: bcx,
712712
datum: Datum {val: scratch,
713713
ty: scratch_ty,
714-
mode: ByRef,
715-
source: RevokeClean}}
714+
mode: ByRef(RevokeClean)}}
716715
}
717716
_ => {
718717
bcx.sess().impossible_case(
@@ -775,7 +774,7 @@ pub fn trans_arg_expr(bcx: block,
775774

776775
match arg_datum.appropriate_mode() {
777776
ByValue => val = Load(bcx, scratch.val),
778-
ByRef => val = scratch.val,
777+
ByRef(_) => val = scratch.val,
779778
}
780779
}
781780
}

src/librustc/middle/trans/closure.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ pub fn build_closure(bcx0: block,
287287
for include_ret_handle.each |flagptr| {
288288
// Flag indicating we have returned (a by-ref bool):
289289
let flag_datum = Datum {val: *flagptr, ty: ty::mk_bool(),
290-
mode: ByRef, source: ZeroMem};
290+
mode: ByRef(ZeroMem)};
291291
env_vals.push(EnvValue {action: EnvRef,
292292
datum: flag_datum});
293293

@@ -299,7 +299,7 @@ pub fn build_closure(bcx0: block,
299299
};
300300
let ret_casted = PointerCast(bcx, ret_true, T_ptr(T_nil()));
301301
let ret_datum = Datum {val: ret_casted, ty: ty::mk_nil(),
302-
mode: ByRef, source: ZeroMem};
302+
mode: ByRef(ZeroMem)};
303303
env_vals.push(EnvValue {action: EnvRef,
304304
datum: ret_datum});
305305
}

0 commit comments

Comments
 (0)