Skip to content

Commit e47035b

Browse files
author
Jorge Aparicio
committed
rustc_trans: unbox closures used in let bindings
1 parent 1e4bbef commit e47035b

File tree

9 files changed

+16
-16
lines changed

9 files changed

+16
-16
lines changed

src/librustc_trans/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ pub const RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET: uint =
127127
pub fn find_crate_name(sess: Option<&Session>,
128128
attrs: &[ast::Attribute],
129129
input: &Input) -> String {
130-
let validate = |s: String, span: Option<Span>| {
130+
let validate = |&: s: String, span: Option<Span>| {
131131
creader::validate_crate_name(sess, s[], span);
132132
s
133133
};

src/librustc_trans/back/write.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
431431

432432
// If we're verifying or linting, add them to the function pass
433433
// manager.
434-
let addpass = |pass: &str| {
434+
let addpass = |&: pass: &str| {
435435
pass.with_c_str(|s| llvm::LLVMRustAddPass(fpm, s))
436436
};
437437
if !config.no_verify { assert!(addpass("verify")); }
@@ -652,7 +652,7 @@ pub fn run_passes(sess: &Session,
652652

653653
// Produce final compile outputs.
654654

655-
let copy_if_one_unit = |ext: &str, output_type: config::OutputType, keep_numbered: bool| {
655+
let copy_if_one_unit = |&: ext: &str, output_type: config::OutputType, keep_numbered: bool| {
656656
// Three cases:
657657
if sess.opts.cg.codegen_units == 1 {
658658
// 1) Only one codegen unit. In this case it's no difficulty
@@ -677,7 +677,7 @@ pub fn run_passes(sess: &Session,
677677
}
678678
};
679679

680-
let link_obj = |output_path: &Path| {
680+
let link_obj = |&: output_path: &Path| {
681681
// Running `ld -r` on a single input is kind of pointless.
682682
if sess.opts.cg.codegen_units == 1 {
683683
fs::copy(&crate_output.with_extension("0.o"),
@@ -993,7 +993,7 @@ unsafe fn configure_llvm(sess: &Session) {
993993
let mut llvm_c_strs = Vec::new();
994994
let mut llvm_args = Vec::new();
995995
{
996-
let add = |arg: &str| {
996+
let mut add = |&mut : arg: &str| {
997997
let s = arg.to_c_str();
998998
llvm_args.push(s.as_ptr());
999999
llvm_c_strs.push(s);

src/librustc_trans/trans/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ fn pick_column_to_specialize(def_map: &DefMap, m: &[Match]) -> Option<uint> {
748748
}
749749
}
750750

751-
let column_score: |&[Match], uint| -> uint = |m, col| {
751+
let column_score = |&: m: &[Match], col: uint| -> uint {
752752
let total_score = m.iter()
753753
.map(|row| row.pats[col])
754754
.map(|pat| pat_score(def_map, pat))

src/librustc_trans/trans/base.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ pub fn compare_scalar_types<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
554554
t: Ty<'tcx>,
555555
op: ast::BinOp)
556556
-> Result<'blk, 'tcx> {
557-
let f = |a| Result::new(cx, compare_scalar_values(cx, lhs, rhs, a, op));
557+
let f = |&: a| Result::new(cx, compare_scalar_values(cx, lhs, rhs, a, op));
558558

559559
match t.sty {
560560
ty::ty_tup(ref tys) if tys.is_empty() => f(nil_type),
@@ -2749,7 +2749,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
27492749
let val = match item {
27502750
ast_map::NodeItem(i) => {
27512751
let ty = ty::node_id_to_type(ccx.tcx(), i.id);
2752-
let sym = || exported_name(ccx, id, ty, i.attrs[]);
2752+
let sym = |&:| exported_name(ccx, id, ty, i.attrs[]);
27532753

27542754
let v = match i.node {
27552755
ast::ItemStatic(_, _, ref expr) => {
@@ -3013,14 +3013,14 @@ fn internalize_symbols(cx: &SharedCrateContext, reachable: &HashSet<String>) {
30133013
unsafe {
30143014
let mut declared = HashSet::new();
30153015

3016-
let iter_globals = |llmod| {
3016+
let iter_globals = |&: llmod| {
30173017
ValueIter {
30183018
cur: llvm::LLVMGetFirstGlobal(llmod),
30193019
step: llvm::LLVMGetNextGlobal,
30203020
}
30213021
};
30223022

3023-
let iter_functions = |llmod| {
3023+
let iter_functions = |&: llmod| {
30243024
ValueIter {
30253025
cur: llvm::LLVMGetFirstFunction(llmod),
30263026
step: llvm::LLVMGetNextFunction,

src/librustc_trans/trans/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ pub fn const_expr<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, e: &ast::Expr)
305305
// the bool returned is whether this expression can be inlined into other crates
306306
// if it's assigned to a static.
307307
fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef {
308-
let map_list = |exprs: &[P<ast::Expr>]| {
308+
let map_list = |&: exprs: &[P<ast::Expr>]| {
309309
exprs.iter().map(|e| const_expr(cx, &**e).0)
310310
.fold(Vec::new(), |mut l, val| { l.push(val); l })
311311
};

src/librustc_trans/trans/debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2489,7 +2489,7 @@ fn prepare_enum_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
24892489
})
24902490
.collect();
24912491

2492-
let discriminant_type_metadata = |inttype| {
2492+
let discriminant_type_metadata = |&: inttype| {
24932493
// We can reuse the type of the discriminant for all monomorphized
24942494
// instances of an enum because it doesn't depend on any type parameters.
24952495
// The def_id, uniquely identifying the enum's polytype acts as key in

src/librustc_trans/trans/foreign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ pub fn trans_rust_fn_with_foreign_abi<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
615615
// Array for the arguments we will pass to the rust function.
616616
let mut llrust_args = Vec::new();
617617
let mut next_foreign_arg_counter: c_uint = 0;
618-
let next_foreign_arg: |pad: bool| -> c_uint = |pad: bool| {
618+
let mut next_foreign_arg = |&mut : pad: bool| -> c_uint {
619619
next_foreign_arg_counter += if pad {
620620
2
621621
} else {

src/librustc_trans/trans/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
181181
// This should be caught by the intrinsicck pass
182182
assert_eq!(in_type_size, out_type_size);
183183

184-
let nonpointer_nonaggregate = |llkind: TypeKind| -> bool {
184+
let nonpointer_nonaggregate = |&: llkind: TypeKind| -> bool {
185185
use llvm::TypeKind::*;
186186
match llkind {
187187
Half | Float | Double | X86_FP80 | FP128 |

src/librustc_trans/trans/monomorphize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
139139

140140
// This shouldn't need to option dance.
141141
let mut hash_id = Some(hash_id);
142-
let mk_lldecl = |abi: abi::Abi| {
142+
let mut mk_lldecl = |&mut : abi: abi::Abi| {
143143
let lldecl = if abi != abi::Rust {
144144
foreign::decl_rust_fn_with_foreign_abi(ccx, mono_ty, s[])
145145
} else {
@@ -149,7 +149,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
149149
ccx.monomorphized().borrow_mut().insert(hash_id.take().unwrap(), lldecl);
150150
lldecl
151151
};
152-
let setup_lldecl = |lldecl, attrs: &[ast::Attribute]| {
152+
let setup_lldecl = |&: lldecl, attrs: &[ast::Attribute]| {
153153
base::update_linkage(ccx, lldecl, None, base::OriginalTranslation);
154154
set_llvm_fn_attrs(ccx, attrs, lldecl);
155155

0 commit comments

Comments
 (0)