Skip to content

Commit 95c53c0

Browse files
committed
back/link -- introduce block to clarify scope of closure
1 parent 8b760fd commit 95c53c0

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

src/librustc/back/link.rs

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -361,21 +361,23 @@ pub mod write {
361361

362362
let mut llvm_c_strs = ~[];
363363
let mut llvm_args = ~[];
364-
let add = |arg: &str| {
365-
let s = arg.to_c_str();
366-
llvm_args.push(s.with_ref(|p| p));
367-
llvm_c_strs.push(s);
368-
};
369-
add("rustc"); // fake program name
370-
add("-arm-enable-ehabi");
371-
add("-arm-enable-ehabi-descriptors");
372-
if vectorize_loop { add("-vectorize-loops"); }
373-
if vectorize_slp { add("-vectorize-slp"); }
374-
if sess.time_llvm_passes() { add("-time-passes"); }
375-
if sess.print_llvm_passes() { add("-debug-pass=Structure"); }
376-
377-
for arg in sess.opts.cg.llvm_args.iter() {
378-
add(*arg);
364+
{
365+
let add = |arg: &str| {
366+
let s = arg.to_c_str();
367+
llvm_args.push(s.with_ref(|p| p));
368+
llvm_c_strs.push(s);
369+
};
370+
add("rustc"); // fake program name
371+
add("-arm-enable-ehabi");
372+
add("-arm-enable-ehabi-descriptors");
373+
if vectorize_loop { add("-vectorize-loops"); }
374+
if vectorize_slp { add("-vectorize-slp"); }
375+
if sess.time_llvm_passes() { add("-time-passes"); }
376+
if sess.print_llvm_passes() { add("-debug-pass=Structure"); }
377+
378+
for arg in sess.opts.cg.llvm_args.iter() {
379+
add(*arg);
380+
}
379381
}
380382

381383
INIT.doit(|| {
@@ -631,7 +633,7 @@ pub fn mangle(sess: Session, ss: ast_map::Path,
631633

632634
let mut n = ~"_ZN"; // _Z == Begin name-sequence, N == nested
633635

634-
let push = |s: &str| {
636+
let push = |n: &mut ~str, s: &str| {
635637
let sani = sanitize(s);
636638
n.push_str(format!("{}{}", sani.len(), sani));
637639
};
@@ -640,7 +642,7 @@ pub fn mangle(sess: Session, ss: ast_map::Path,
640642
for s in ss.iter() {
641643
match *s {
642644
PathName(s) | PathMod(s) | PathPrettyName(s, _) => {
643-
push(sess.str_of(s))
645+
push(&mut n, sess.str_of(s))
644646
}
645647
}
646648
}
@@ -665,10 +667,10 @@ pub fn mangle(sess: Session, ss: ast_map::Path,
665667
}
666668
}
667669
if hash.len() > 0 {
668-
push(hash);
670+
push(&mut n, hash);
669671
}
670672
match vers {
671-
Some(s) => push(s),
673+
Some(s) => push(&mut n, s),
672674
None => {}
673675
}
674676

0 commit comments

Comments
 (0)