Skip to content

Commit 9521551

Browse files
committed
librustc: Fix merge fallout.
1 parent 151b7ed commit 9521551

24 files changed

+43
-59
lines changed

src/libextra/json.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,7 +1983,7 @@ mod tests {
19831983
}
19841984
fn check_err<T: Decodable<Decoder>>(to_parse: &'static str, expected_error: &str) {
19851985
use std::task;
1986-
let res = task::try(|| {
1986+
let res = do task::try {
19871987
// either fails in `decode` (which is what we want), or
19881988
// returns Some(error_message)/None if the string was
19891989
// invalid or valid JSON.
@@ -1994,7 +1994,7 @@ mod tests {
19941994
None
19951995
}
19961996
}
1997-
});
1997+
};
19981998
match res {
19991999
Ok(Some(parse_error)) => fail!("`{}` is not valid json: {}",
20002000
to_parse, parse_error),

src/libextra/sync.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,8 @@ impl<'self> Condvar<'self> {
230230
}).finally(|| {
231231
// Reacquire the condvar.
232232
match self.order {
233-
Just(lock) => do lock.access {
234-
self.sem.acquire();
235-
},
236-
Nothing => {
237-
self.sem.acquire();
238-
},
233+
Just(lock) => lock.access(|| self.sem.acquire()),
234+
Nothing => self.sem.acquire(),
239235
}
240236
})
241237
})

src/libextra/time.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,9 +969,9 @@ mod tests {
969969
// Windows does not understand "America/Los_Angeles".
970970
// PST+08 may look wrong, but not! "PST" indicates
971971
// the name of timezone. "+08" means UTC = local + 08.
972-
do "TZ=PST+08".with_c_str |env| {
972+
"TZ=PST+08".with_c_str(|env| {
973973
_putenv(env);
974-
}
974+
})
975975
}
976976
tzset();
977977
}

src/librustc/middle/lint.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,17 +1204,17 @@ impl<'self> Visitor<()> for Context<'self> {
12041204
}
12051205

12061206
fn visit_foreign_item(&mut self, it: @ast::foreign_item, _: ()) {
1207-
do self.with_lint_attrs(it.attrs) |cx| {
1207+
self.with_lint_attrs(it.attrs, |cx| {
12081208
check_attrs_usage(cx, it.attrs);
12091209
visit::walk_foreign_item(cx, it, ());
1210-
}
1210+
})
12111211
}
12121212

12131213
fn visit_view_item(&mut self, i: &ast::view_item, _: ()) {
1214-
do self.with_lint_attrs(i.attrs) |cx| {
1214+
self.with_lint_attrs(i.attrs, |cx| {
12151215
check_attrs_usage(cx, i.attrs);
12161216
visit::walk_view_item(cx, i, ());
1217-
}
1217+
})
12181218
}
12191219

12201220
fn visit_pat(&mut self, p: &ast::Pat, _: ()) {

src/librustc/middle/privacy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ impl<'self> Visitor<()> for EmbargoVisitor<'self> {
232232
_ => true,
233233
};
234234
let tr = ty::impl_trait_ref(self.tcx, local_def(item.id));
235-
let public_trait = do tr.map_default(false) |tr| {
235+
let public_trait = tr.map_default(false, |tr| {
236236
!is_local(tr.def_id) ||
237237
self.exported_items.contains(&tr.def_id.node)
238-
};
238+
});
239239

240240
if public_ty || public_trait {
241241
for method in methods.iter() {

src/librustpkg/testsuite/pass/src/c-dependencies/pkg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn main() {
5050
prep.declare_input("file",
5151
foo_c_name.as_str().unwrap().to_owned(),
5252
digest_file_with_date(&foo_c_name));
53-
let out_path = prep.exec(|exec| {
53+
let out_path = do prep.exec |exec| {
5454
let out_path = api::build_library_in_workspace(exec,
5555
&mut sub_cx.clone(),
5656
"cdep",
@@ -60,7 +60,7 @@ pub fn main() {
6060
"foo");
6161
let out_p = Path::new(out_path);
6262
out_p.as_str().unwrap().to_owned()
63-
});
63+
};
6464
out_path
6565
});
6666
let out_lib_path = Path::new(out_lib_path);

src/librustuv/net.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ impl TcpWatcher {
186186
0 => {
187187
req.defuse(); // uv callback now owns this request
188188
let mut cx = Ctx { status: 0, task: None };
189-
do wait_until_woken_after(&mut cx.task) {
189+
wait_until_woken_after(&mut cx.task, || {
190190
req.set_data(&cx);
191-
}
191+
});
192192
match cx.status {
193193
0 => Ok(()),
194194
n => Err(UvError(n)),

src/libstd/rc.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -168,28 +168,6 @@ impl<T> Drop for Rc<T> {
168168
}
169169
}
170170

171-
impl<T> Clone for RcMut<T> {
172-
/// Return a shallow copy of the reference counted pointer.
173-
#[inline]
174-
fn clone(&self) -> RcMut<T> {
175-
unsafe {
176-
(*self.ptr).count += 1;
177-
RcMut{ptr: self.ptr}
178-
}
179-
}
180-
}
181-
182-
impl<T: DeepClone> DeepClone for RcMut<T> {
183-
/// Return a deep copy of the reference counted pointer.
184-
#[inline]
185-
fn deep_clone(&self) -> RcMut<T> {
186-
self.with_borrow(|x| {
187-
// FIXME: #6497: should avoid freeze (slow)
188-
unsafe { RcMut::new_unchecked(x.deep_clone()) }
189-
})
190-
}
191-
}
192-
193171
#[cfg(test)]
194172
mod test_rc {
195173
use super::*;

src/libstd/rt/args.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ mod imp {
150150
assert!(take() == Some(expected.clone()));
151151
assert!(take() == None);
152152

153-
do (|| {
154-
}).finally {
153+
(|| {
154+
}).finally(|| {
155155
// Restore the actual global state.
156156
match saved_value {
157157
Some(ref args) => put(args.clone()),
158158
None => ()
159159
}
160-
}
160+
})
161161
}
162162
}
163163
}

src/libstd/rt/comm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,11 +990,11 @@ mod test {
990990
#[test]
991991
fn recv_a_lot() {
992992
// Regression test that we don't run out of stack in scheduler context
993-
run_in_newsched_task(|| {
993+
do run_in_newsched_task {
994994
let (port, chan) = stream();
995995
10000.times(|| { chan.send(()) });
996996
10000.times(|| { port.recv() });
997-
})
997+
}
998998
}
999999

10001000
#[test]

src/libstd/select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub fn select<A: Select>(ports: &mut [A]) -> uint {
7676

7777
let c = Cell::new(c.take());
7878
do sched.event_loop.callback { c.take().send_deferred(()) }
79-
}
79+
})
8080
}).finally(|| {
8181
// Unkillable is necessary not because getting killed is dangerous here,
8282
// but to force the recv not to use the same kill-flag that we used for

src/libstd/unstable/sync.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl<T: Send> UnsafeArc<T> {
135135
/// block; otherwise, an unwrapping task can be killed by linked failure.
136136
pub fn unwrap(self) -> T {
137137
unsafe {
138-
let mut this = this;
138+
let mut this = self;
139139
// The ~ dtor needs to run if this code succeeds.
140140
let mut data: ~ArcData<T> = cast::transmute(this.data);
141141
// Set up the unwrap protocol.
@@ -192,7 +192,7 @@ impl<T: Send> UnsafeArc<T> {
192192
cast::forget(data);
193193
fail!("Another task is already unwrapping this Arc!");
194194
}
195-
})
195+
}
196196
}
197197

198198
/// As unwrap above, but without blocking. Returns 'UnsafeArcSelf(self)' if this is

src/libstd/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,11 +863,11 @@ pub trait ImmutableVector<'self, T> {
863863
/// Returns an iterator over the subslices of the vector which are
864864
/// separated by elements that match `pred`, limited to splitting
865865
/// at most `n` times.
866-
fn splitn(self, n: uint, pred: |&T| -> bool) -> SplitIterator<'self, T>;
866+
fn splitn(self, n: uint, pred: 'self |&T| -> bool) -> SplitIterator<'self, T>;
867867
/// Returns an iterator over the subslices of the vector which are
868868
/// separated by elements that match `pred`. This starts at the
869869
/// end of the vector and works backwards.
870-
fn rsplit(self, pred: |&T| -> bool) -> RSplitIterator<'self, T>;
870+
fn rsplit(self, pred: 'self |&T| -> bool) -> RSplitIterator<'self, T>;
871871
/// Returns an iterator over the subslices of the vector which are
872872
/// separated by elements that match `pred` limited to splitting
873873
/// at most `n` times. This starts at the end of the vector and

src/test/bench/core-set.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// xfail-pretty
2+
13
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
24
// file at the top-level directory of this distribution and at
35
// http://rust-lang.org/COPYRIGHT.

src/test/bench/shootout-pfib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ fn fib(n: int) -> int {
3737
let (pp, cc) = stream();
3838
let cc = SharedChan::new(cc);
3939
let ch = cc.clone();
40-
task::spawn(|| pfib(&ch, n - 1) );
40+
task::spawn(proc() pfib(&ch, n - 1));
4141
let ch = cc.clone();
42-
task::spawn(|| pfib(&ch, n - 2) );
42+
task::spawn(proc() pfib(&ch, n - 2));
4343
c.send(pp.recv() + pp.recv());
4444
}
4545
}

src/test/bench/task-perf-spawnalot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::uint;
1515
fn f(n: uint) {
1616
let mut i = 0u;
1717
while i < n {
18-
task::try(|| g() );
18+
task::try(proc() g());
1919
i += 1u;
2020
}
2121
}

src/test/debug-info/lexical-scope-in-unique-closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ fn main() {
5151
zzz();
5252
sentinel();
5353

54-
let unique_closure: proc(int) = |x| {
54+
let unique_closure: proc(int) = proc(x) {
5555
zzz();
5656
sentinel();
5757

src/test/debug-info/var-captured-in-sendable-closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn main() {
3939

4040
let owned = ~5;
4141

42-
let closure: proc() = || {
42+
let closure: proc() = proc() {
4343
zzz();
4444
do_something(&constant, &a_struct.a, owned);
4545
};

src/test/pretty/disamb-stmt-expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616

1717
fn id(f: || -> int) -> int { f() }
1818

19-
fn wsucc(_n: int) -> int { (do id || { 1 }) - 0 }
19+
fn wsucc(_n: int) -> int { id(|| { 1 }) - 0 }
2020
fn main() { }

src/test/pretty/do1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212

1313
fn f(f: |int|) { f(10) }
1414

15-
fn main() { do f |i| { assert!(i == 10) } }
15+
fn main() { f(|i| { assert!(i == 10) }) }

src/test/run-pass/borrowck-preserve-box-in-field.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// xfail-pretty
2+
13
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
24
// file at the top-level directory of this distribution and at
35
// http://rust-lang.org/COPYRIGHT.

src/test/run-pass/borrowck-preserve-box-in-uniq.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// xfail-pretty
2+
13
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
24
// file at the top-level directory of this distribution and at
35
// http://rust-lang.org/COPYRIGHT.

src/test/run-pass/borrowck-preserve-box.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// xfail-pretty
2+
13
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
24
// file at the top-level directory of this distribution and at
35
// http://rust-lang.org/COPYRIGHT.

src/test/run-pass/borrowck-preserve-expl-deref.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// xfail-pretty
2+
13
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
24
// file at the top-level directory of this distribution and at
35
// http://rust-lang.org/COPYRIGHT.

0 commit comments

Comments
 (0)