Skip to content

Commit aefcf69

Browse files
author
Cameron Zwarich
committed
---
yaml --- r: 152518 b: refs/heads/try2 c: 159e27a h: refs/heads/master v: v3
1 parent e0c1ba6 commit aefcf69

File tree

16 files changed

+207
-114
lines changed

16 files changed

+207
-114
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 036833ece95aa5fc9a1110c5691488193138eb8f
8+
refs/heads/try2: 159e27aebb940926ccf1bad0b2b12087d36ad903
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libarena/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,8 @@ impl<T> TypedArenaChunk<T> {
406406
None => {}
407407
Some(mut next) => {
408408
// We assume that the next chunk is completely filled.
409-
next.destroy(next.capacity)
409+
let capacity = next.capacity;
410+
next.destroy(capacity)
410411
}
411412
}
412413
}

branches/try2/src/libcollections/ringbuf.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ impl<T> Deque<T> for RingBuf<T> {
6666

6767
/// Return a mutable reference to the last element in the RingBuf
6868
fn back_mut<'a>(&'a mut self) -> Option<&'a mut T> {
69-
if self.nelts > 0 { Some(self.get_mut(self.nelts - 1)) } else { None }
69+
let nelts = self.nelts;
70+
if nelts > 0 { Some(self.get_mut(nelts - 1)) } else { None }
7071
}
7172

7273
/// Remove and return the first element in the RingBuf, or None if it is empty

branches/try2/src/libcollections/vec.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ impl<T> Vec<T> {
114114
unsafe {
115115
let mut xs = Vec::with_capacity(length);
116116
while xs.len < length {
117-
ptr::write(xs.as_mut_slice().unsafe_mut_ref(xs.len), op(xs.len));
117+
let len = xs.len;
118+
ptr::write(xs.as_mut_slice().unsafe_mut_ref(len), op(len));
118119
xs.len += 1;
119120
}
120121
xs
@@ -210,7 +211,8 @@ impl<T: Clone> Vec<T> {
210211
unsafe {
211212
let mut xs = Vec::with_capacity(length);
212213
while xs.len < length {
213-
ptr::write(xs.as_mut_slice().unsafe_mut_ref(xs.len),
214+
let len = xs.len;
215+
ptr::write(xs.as_mut_slice().unsafe_mut_ref(len),
214216
value.clone());
215217
xs.len += 1;
216218
}
@@ -321,9 +323,10 @@ impl<T:Clone> Clone for Vec<T> {
321323
let this_slice = self.as_slice();
322324
while vector.len < len {
323325
unsafe {
326+
let len = vector.len;
324327
ptr::write(
325-
vector.as_mut_slice().unsafe_mut_ref(vector.len),
326-
this_slice.unsafe_ref(vector.len).clone());
328+
vector.as_mut_slice().unsafe_mut_ref(len),
329+
this_slice.unsafe_ref(len).clone());
327330
}
328331
vector.len += 1;
329332
}

branches/try2/src/libdebug/repr.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,15 @@ impl<'a> ReprVisitor<'a> {
127127
#[inline]
128128
pub fn get<T>(&mut self, f: |&mut ReprVisitor, &T| -> bool) -> bool {
129129
unsafe {
130-
f(self, mem::transmute::<*u8,&T>(self.ptr))
130+
let ptr = self.ptr;
131+
f(self, mem::transmute::<*u8,&T>(ptr))
131132
}
132133
}
133134

134135
#[inline]
135136
pub fn visit_inner(&mut self, inner: *TyDesc) -> bool {
136-
self.visit_ptr_inner(self.ptr, inner)
137+
let ptr = self.ptr;
138+
self.visit_ptr_inner(ptr, inner)
137139
}
138140

139141
#[inline]

branches/try2/src/libnative/io/net.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,16 +637,15 @@ impl rtio::RtioUdpSocket for UdpSocket {
637637
mem::size_of::<libc::sockaddr_storage>() as libc::socklen_t;
638638

639639
let dolock = || self.lock_nonblocking();
640-
let doread = |nb| unsafe {
640+
let n = try!(read(fd, self.read_deadline, dolock, |nb| unsafe {
641641
let flags = if nb {c::MSG_DONTWAIT} else {0};
642642
libc::recvfrom(fd,
643643
buf.as_mut_ptr() as *mut libc::c_void,
644644
buf.len() as msglen_t,
645645
flags,
646646
storagep,
647647
&mut addrlen) as libc::c_int
648-
};
649-
let n = try!(read(fd, self.read_deadline, dolock, doread));
648+
}));
650649
sockaddr_to_addr(&storage, addrlen as uint).and_then(|addr| {
651650
Ok((n as uint, addr))
652651
})

branches/try2/src/libregex/parse/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,18 +345,19 @@ impl<'a> Parser<'a> {
345345
}
346346

347347
fn push_literal(&mut self, c: char) -> Result<(), Error> {
348+
let flags = self.flags;
348349
match c {
349350
'.' => {
350-
self.push(Dot(self.flags))
351+
self.push(Dot(flags))
351352
}
352353
'^' => {
353-
self.push(Begin(self.flags))
354+
self.push(Begin(flags))
354355
}
355356
'$' => {
356-
self.push(End(self.flags))
357+
self.push(End(flags))
357358
}
358359
_ => {
359-
self.push(Literal(c, self.flags))
360+
self.push(Literal(c, flags))
360361
}
361362
}
362363
Ok(())

branches/try2/src/librustc/middle/dataflow.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,13 @@ impl<'a, O:DataFlowOperator+Clone+'static> DataFlowContext<'a, O> {
300300
}
301301

302302
{
303+
let words_per_id = self.words_per_id;
303304
let mut propcx = PropagationContext {
304305
dfcx: &mut *self,
305306
changed: true
306307
};
307308

308-
let mut temp = Vec::from_elem(self.words_per_id, 0u);
309+
let mut temp = Vec::from_elem(words_per_id, 0u);
309310
let mut loop_scopes = Vec::new();
310311

311312
while propcx.changed {

branches/try2/src/librustc/middle/liveness.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -547,11 +547,13 @@ struct Liveness<'a> {
547547

548548
impl<'a> Liveness<'a> {
549549
fn new(ir: &'a mut IrMaps<'a>, specials: Specials) -> Liveness<'a> {
550+
let num_live_nodes = ir.num_live_nodes;
551+
let num_vars = ir.num_vars;
550552
Liveness {
551553
ir: ir,
552554
s: specials,
553-
successors: Vec::from_elem(ir.num_live_nodes, invalid_node()),
554-
users: Vec::from_elem(ir.num_live_nodes * ir.num_vars, invalid_users()),
555+
successors: Vec::from_elem(num_live_nodes, invalid_node()),
556+
users: Vec::from_elem(num_live_nodes * num_vars, invalid_users()),
555557
loop_scope: Vec::new(),
556558
break_ln: NodeMap::new(),
557559
cont_ln: NodeMap::new(),
@@ -826,8 +828,9 @@ impl<'a> Liveness<'a> {
826828

827829
debug!("compute: using id for block, {}", block_to_str(body));
828830

831+
let exit_ln = self.s.exit_ln;
829832
let entry_ln: LiveNode =
830-
self.with_loop_nodes(body.id, self.s.exit_ln, self.s.exit_ln,
833+
self.with_loop_nodes(body.id, exit_ln, exit_ln,
831834
|this| this.propagate_through_fn_block(decl, body));
832835

833836
// hack to skip the loop unless debug! is enabled:
@@ -847,12 +850,13 @@ impl<'a> Liveness<'a> {
847850
-> LiveNode {
848851
// the fallthrough exit is only for those cases where we do not
849852
// explicitly return:
850-
self.init_from_succ(self.s.fallthrough_ln, self.s.exit_ln);
853+
let s = self.s;
854+
self.init_from_succ(s.fallthrough_ln, s.exit_ln);
851855
if blk.expr.is_none() {
852-
self.acc(self.s.fallthrough_ln, self.s.no_ret_var, ACC_READ)
856+
self.acc(s.fallthrough_ln, s.no_ret_var, ACC_READ)
853857
}
854858

855-
self.propagate_through_block(blk, self.s.fallthrough_ln)
859+
self.propagate_through_block(blk, s.fallthrough_ln)
856860
}
857861

858862
fn propagate_through_block(&mut self, blk: &Block, succ: LiveNode)
@@ -1036,7 +1040,8 @@ impl<'a> Liveness<'a> {
10361040

10371041
ExprRet(o_e) => {
10381042
// ignore succ and subst exit_ln:
1039-
self.propagate_through_opt_expr(o_e, self.s.exit_ln)
1043+
let exit_ln = self.s.exit_ln;
1044+
self.propagate_through_opt_expr(o_e, exit_ln)
10401045
}
10411046

10421047
ExprBreak(opt_label) => {

branches/try2/src/librustc/middle/privacy.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,9 +1019,10 @@ impl<'a> Visitor<()> for SanePrivacyVisitor<'a> {
10191019
self.check_sane_privacy(item);
10201020
}
10211021

1022+
let in_fn = self.in_fn;
10221023
let orig_in_fn = replace(&mut self.in_fn, match item.node {
10231024
ast::ItemMod(..) => false, // modules turn privacy back on
1024-
_ => self.in_fn, // otherwise we inherit
1025+
_ => in_fn, // otherwise we inherit
10251026
});
10261027
visit::walk_item(self, item, ());
10271028
self.in_fn = orig_in_fn;

branches/try2/src/libsyntax/ext/format.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ impl<'a, 'b> Context<'a, 'b> {
202202
}
203203
parse::CountIsNextParam => {
204204
if self.check_positional_ok() {
205-
self.verify_arg_type(Exact(self.next_arg), Unsigned);
205+
let next_arg = self.next_arg;
206+
self.verify_arg_type(Exact(next_arg), Unsigned);
206207
self.next_arg += 1;
207208
}
208209
}

branches/try2/src/libsyntax/parse/attr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ impl<'a> ParserAttr for Parser<'a> {
7373

7474
let style = if self.eat(&token::NOT) {
7575
if !permit_inner {
76-
self.span_err(self.span,
76+
let span = self.span;
77+
self.span_err(span,
7778
"an inner attribute is not permitted in \
7879
this context");
7980
}

0 commit comments

Comments
 (0)