Skip to content

Commit 1f15c4b

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 171822 b: refs/heads/beta c: bf52e26 h: refs/heads/master v: v3
1 parent 34e4b65 commit 1f15c4b

File tree

4 files changed

+41
-38
lines changed

4 files changed

+41
-38
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b5571ed71a5879c0495a982506258d5d267744ed
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: 977e151b9a74af6cdb92b7afb57a4dbacc799841
34+
refs/heads/beta: bf52e262e20efaaadf3fec47f20880ffc171a34f
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928

branches/beta/src/librustc_trans/trans/base.rs

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -669,30 +669,31 @@ pub fn compare_simd_types<'blk, 'tcx>(
669669
}
670670
}
671671

672-
pub type val_and_ty_fn<'a, 'blk, 'tcx> =
673-
|Block<'blk, 'tcx>, ValueRef, Ty<'tcx>|: 'a -> Block<'blk, 'tcx>;
674-
675672
// Iterates through the elements of a structural type.
676-
pub fn iter_structural_ty<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>,
677-
av: ValueRef,
678-
t: Ty<'tcx>,
679-
f: val_and_ty_fn<'a, 'blk, 'tcx>)
680-
-> Block<'blk, 'tcx> {
673+
pub fn iter_structural_ty<'blk, 'tcx, F>(cx: Block<'blk, 'tcx>,
674+
av: ValueRef,
675+
t: Ty<'tcx>,
676+
mut f: F)
677+
-> Block<'blk, 'tcx> where
678+
F: FnMut(Block<'blk, 'tcx>, ValueRef, Ty<'tcx>) -> Block<'blk, 'tcx>,
679+
{
681680
let _icx = push_ctxt("iter_structural_ty");
682681

683-
fn iter_variant<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>,
684-
repr: &adt::Repr<'tcx>,
685-
av: ValueRef,
686-
variant: &ty::VariantInfo<'tcx>,
687-
substs: &subst::Substs<'tcx>,
688-
f: val_and_ty_fn<'a, 'blk, 'tcx>)
689-
-> Block<'blk, 'tcx> {
682+
fn iter_variant<'blk, 'tcx, F>(cx: Block<'blk, 'tcx>,
683+
repr: &adt::Repr<'tcx>,
684+
av: ValueRef,
685+
variant: &ty::VariantInfo<'tcx>,
686+
substs: &subst::Substs<'tcx>,
687+
f: &mut F)
688+
-> Block<'blk, 'tcx> where
689+
F: FnMut(Block<'blk, 'tcx>, ValueRef, Ty<'tcx>) -> Block<'blk, 'tcx>,
690+
{
690691
let _icx = push_ctxt("iter_variant");
691692
let tcx = cx.tcx();
692693
let mut cx = cx;
693694

694695
for (i, &arg) in variant.args.iter().enumerate() {
695-
cx = f(cx,
696+
cx = (*f)(cx,
696697
adt::trans_field_ptr(cx, repr, av, variant.disr_val, i),
697698
arg.subst(tcx, substs));
698699
}
@@ -764,7 +765,7 @@ pub fn iter_structural_ty<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>,
764765
match adt::trans_switch(cx, &*repr, av) {
765766
(_match::Single, None) => {
766767
cx = iter_variant(cx, &*repr, av, &*(*variants)[0],
767-
substs, f);
768+
substs, &mut f);
768769
}
769770
(_match::Switch, Some(lldiscrim_a)) => {
770771
cx = f(cx, lldiscrim_a, cx.tcx().types.int);
@@ -793,7 +794,7 @@ pub fn iter_structural_ty<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>,
793794
data_ptr,
794795
&**variant,
795796
substs,
796-
|x,y,z| f(x,y,z));
797+
&mut f);
797798
Br(variant_cx, next_cx.llbb);
798799
}
799800
cx = next_cx;

branches/beta/src/librustc_trans/trans/glue.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,13 +531,14 @@ fn declare_generic_glue<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>,
531531
return (fn_nm, llfn);
532532
}
533533

534-
fn make_generic_glue<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
535-
t: Ty<'tcx>,
536-
llfn: ValueRef,
537-
helper: for<'blk> |Block<'blk, 'tcx>, ValueRef, Ty<'tcx>|
538-
-> Block<'blk, 'tcx>,
539-
name: &str)
540-
-> ValueRef {
534+
fn make_generic_glue<'a, 'tcx, F>(ccx: &CrateContext<'a, 'tcx>,
535+
t: Ty<'tcx>,
536+
llfn: ValueRef,
537+
helper: F,
538+
name: &str)
539+
-> ValueRef where
540+
F: for<'blk> FnOnce(Block<'blk, 'tcx>, ValueRef, Ty<'tcx>) -> Block<'blk, 'tcx>,
541+
{
541542
let _icx = push_ctxt("make_generic_glue");
542543
let glue_name = format!("glue {} {}", name, ty_to_short_str(ccx.tcx(), t));
543544
let _s = StatRecorder::new(ccx, glue_name);

branches/beta/src/librustc_trans/trans/tvec.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -416,15 +416,14 @@ pub fn get_base_and_len(bcx: Block,
416416
}
417417
}
418418

419-
pub type iter_vec_block<'a, 'blk, 'tcx> =
420-
|Block<'blk, 'tcx>, ValueRef, Ty<'tcx>|: 'a -> Block<'blk, 'tcx>;
421-
422-
pub fn iter_vec_loop<'a, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
419+
pub fn iter_vec_loop<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
423420
data_ptr: ValueRef,
424421
vt: &VecTypes<'tcx>,
425422
count: ValueRef,
426-
f: iter_vec_block<'a, 'blk, 'tcx>)
427-
-> Block<'blk, 'tcx> {
423+
f: F)
424+
-> Block<'blk, 'tcx> where
425+
F: FnOnce(Block<'blk, 'tcx>, ValueRef, Ty<'tcx>) -> Block<'blk, 'tcx>,
426+
{
428427
let _icx = push_ctxt("tvec::iter_vec_loop");
429428
let fcx = bcx.fcx;
430429

@@ -475,12 +474,14 @@ pub fn iter_vec_loop<'a, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
475474
next_bcx
476475
}
477476

478-
pub fn iter_vec_raw<'a, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
479-
data_ptr: ValueRef,
480-
unit_ty: Ty<'tcx>,
481-
len: ValueRef,
482-
f: iter_vec_block<'a, 'blk, 'tcx>)
483-
-> Block<'blk, 'tcx> {
477+
pub fn iter_vec_raw<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
478+
data_ptr: ValueRef,
479+
unit_ty: Ty<'tcx>,
480+
len: ValueRef,
481+
f: F)
482+
-> Block<'blk, 'tcx> where
483+
F: FnOnce(Block<'blk, 'tcx>, ValueRef, Ty<'tcx>) -> Block<'blk, 'tcx>,
484+
{
484485
let _icx = push_ctxt("tvec::iter_vec_raw");
485486
let fcx = bcx.fcx;
486487

0 commit comments

Comments
 (0)