From 9521551b4710805674ad6c1755bef4e76784db02 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Sun, 24 Nov 2013 11:44:28 -0800 Subject: [PATCH] librustc: Fix merge fallout. --- src/libextra/json.rs | 4 ++-- src/libextra/sync.rs | 8 ++----- src/libextra/time.rs | 4 ++-- src/librustc/middle/lint.rs | 8 +++---- src/librustc/middle/privacy.rs | 4 ++-- .../testsuite/pass/src/c-dependencies/pkg.rs | 4 ++-- src/librustuv/net.rs | 4 ++-- src/libstd/rc.rs | 22 ------------------- src/libstd/rt/args.rs | 6 ++--- src/libstd/rt/comm.rs | 4 ++-- src/libstd/select.rs | 2 +- src/libstd/unstable/sync.rs | 4 ++-- src/libstd/vec.rs | 4 ++-- src/test/bench/core-set.rs | 2 ++ src/test/bench/shootout-pfib.rs | 4 ++-- src/test/bench/task-perf-spawnalot.rs | 2 +- .../lexical-scope-in-unique-closure.rs | 2 +- .../var-captured-in-sendable-closure.rs | 2 +- src/test/pretty/disamb-stmt-expr.rs | 2 +- src/test/pretty/do1.rs | 2 +- .../borrowck-preserve-box-in-field.rs | 2 ++ .../run-pass/borrowck-preserve-box-in-uniq.rs | 2 ++ src/test/run-pass/borrowck-preserve-box.rs | 2 ++ .../run-pass/borrowck-preserve-expl-deref.rs | 2 ++ 24 files changed, 43 insertions(+), 59 deletions(-) diff --git a/src/libextra/json.rs b/src/libextra/json.rs index c3096356828..8dcf0a919d3 100644 --- a/src/libextra/json.rs +++ b/src/libextra/json.rs @@ -1983,7 +1983,7 @@ mod tests { } fn check_err>(to_parse: &'static str, expected_error: &str) { use std::task; - let res = task::try(|| { + let res = do task::try { // either fails in `decode` (which is what we want), or // returns Some(error_message)/None if the string was // invalid or valid JSON. @@ -1994,7 +1994,7 @@ mod tests { None } } - }); + }; match res { Ok(Some(parse_error)) => fail!("`{}` is not valid json: {}", to_parse, parse_error), diff --git a/src/libextra/sync.rs b/src/libextra/sync.rs index 0d5368695b7..6167a429380 100644 --- a/src/libextra/sync.rs +++ b/src/libextra/sync.rs @@ -230,12 +230,8 @@ impl<'self> Condvar<'self> { }).finally(|| { // Reacquire the condvar. match self.order { - Just(lock) => do lock.access { - self.sem.acquire(); - }, - Nothing => { - self.sem.acquire(); - }, + Just(lock) => lock.access(|| self.sem.acquire()), + Nothing => self.sem.acquire(), } }) }) diff --git a/src/libextra/time.rs b/src/libextra/time.rs index fb80ce02625..1352bfd424f 100644 --- a/src/libextra/time.rs +++ b/src/libextra/time.rs @@ -969,9 +969,9 @@ mod tests { // Windows does not understand "America/Los_Angeles". // PST+08 may look wrong, but not! "PST" indicates // the name of timezone. "+08" means UTC = local + 08. - do "TZ=PST+08".with_c_str |env| { + "TZ=PST+08".with_c_str(|env| { _putenv(env); - } + }) } tzset(); } diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 29e28204bd9..38b7bc0875b 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -1204,17 +1204,17 @@ impl<'self> Visitor<()> for Context<'self> { } fn visit_foreign_item(&mut self, it: @ast::foreign_item, _: ()) { - do self.with_lint_attrs(it.attrs) |cx| { + self.with_lint_attrs(it.attrs, |cx| { check_attrs_usage(cx, it.attrs); visit::walk_foreign_item(cx, it, ()); - } + }) } fn visit_view_item(&mut self, i: &ast::view_item, _: ()) { - do self.with_lint_attrs(i.attrs) |cx| { + self.with_lint_attrs(i.attrs, |cx| { check_attrs_usage(cx, i.attrs); visit::walk_view_item(cx, i, ()); - } + }) } fn visit_pat(&mut self, p: &ast::Pat, _: ()) { diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 90bbbaeaf6f..c2a21905be6 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -232,10 +232,10 @@ impl<'self> Visitor<()> for EmbargoVisitor<'self> { _ => true, }; let tr = ty::impl_trait_ref(self.tcx, local_def(item.id)); - let public_trait = do tr.map_default(false) |tr| { + let public_trait = tr.map_default(false, |tr| { !is_local(tr.def_id) || self.exported_items.contains(&tr.def_id.node) - }; + }); if public_ty || public_trait { for method in methods.iter() { diff --git a/src/librustpkg/testsuite/pass/src/c-dependencies/pkg.rs b/src/librustpkg/testsuite/pass/src/c-dependencies/pkg.rs index 180f8cc74ce..122f80a52f1 100644 --- a/src/librustpkg/testsuite/pass/src/c-dependencies/pkg.rs +++ b/src/librustpkg/testsuite/pass/src/c-dependencies/pkg.rs @@ -50,7 +50,7 @@ pub fn main() { prep.declare_input("file", foo_c_name.as_str().unwrap().to_owned(), digest_file_with_date(&foo_c_name)); - let out_path = prep.exec(|exec| { + let out_path = do prep.exec |exec| { let out_path = api::build_library_in_workspace(exec, &mut sub_cx.clone(), "cdep", @@ -60,7 +60,7 @@ pub fn main() { "foo"); let out_p = Path::new(out_path); out_p.as_str().unwrap().to_owned() - }); + }; out_path }); let out_lib_path = Path::new(out_lib_path); diff --git a/src/librustuv/net.rs b/src/librustuv/net.rs index 8372127c671..7fb665b858f 100644 --- a/src/librustuv/net.rs +++ b/src/librustuv/net.rs @@ -186,9 +186,9 @@ impl TcpWatcher { 0 => { req.defuse(); // uv callback now owns this request let mut cx = Ctx { status: 0, task: None }; - do wait_until_woken_after(&mut cx.task) { + wait_until_woken_after(&mut cx.task, || { req.set_data(&cx); - } + }); match cx.status { 0 => Ok(()), n => Err(UvError(n)), diff --git a/src/libstd/rc.rs b/src/libstd/rc.rs index 9506a772ee8..f2beea992c6 100644 --- a/src/libstd/rc.rs +++ b/src/libstd/rc.rs @@ -168,28 +168,6 @@ impl Drop for Rc { } } -impl Clone for RcMut { - /// Return a shallow copy of the reference counted pointer. - #[inline] - fn clone(&self) -> RcMut { - unsafe { - (*self.ptr).count += 1; - RcMut{ptr: self.ptr} - } - } -} - -impl DeepClone for RcMut { - /// Return a deep copy of the reference counted pointer. - #[inline] - fn deep_clone(&self) -> RcMut { - self.with_borrow(|x| { - // FIXME: #6497: should avoid freeze (slow) - unsafe { RcMut::new_unchecked(x.deep_clone()) } - }) - } -} - #[cfg(test)] mod test_rc { use super::*; diff --git a/src/libstd/rt/args.rs b/src/libstd/rt/args.rs index 82b98fa7f9a..43e8096a8b1 100644 --- a/src/libstd/rt/args.rs +++ b/src/libstd/rt/args.rs @@ -150,14 +150,14 @@ mod imp { assert!(take() == Some(expected.clone())); assert!(take() == None); - do (|| { - }).finally { + (|| { + }).finally(|| { // Restore the actual global state. match saved_value { Some(ref args) => put(args.clone()), None => () } - } + }) } } } diff --git a/src/libstd/rt/comm.rs b/src/libstd/rt/comm.rs index 52a6d67cb05..06743bce9bf 100644 --- a/src/libstd/rt/comm.rs +++ b/src/libstd/rt/comm.rs @@ -990,11 +990,11 @@ mod test { #[test] fn recv_a_lot() { // Regression test that we don't run out of stack in scheduler context - run_in_newsched_task(|| { + do run_in_newsched_task { let (port, chan) = stream(); 10000.times(|| { chan.send(()) }); 10000.times(|| { port.recv() }); - }) + } } #[test] diff --git a/src/libstd/select.rs b/src/libstd/select.rs index 9b83c493065..43f1c3c5296 100644 --- a/src/libstd/select.rs +++ b/src/libstd/select.rs @@ -76,7 +76,7 @@ pub fn select(ports: &mut [A]) -> uint { let c = Cell::new(c.take()); do sched.event_loop.callback { c.take().send_deferred(()) } - } + }) }).finally(|| { // Unkillable is necessary not because getting killed is dangerous here, // but to force the recv not to use the same kill-flag that we used for diff --git a/src/libstd/unstable/sync.rs b/src/libstd/unstable/sync.rs index 1f243d08243..03745c2c348 100644 --- a/src/libstd/unstable/sync.rs +++ b/src/libstd/unstable/sync.rs @@ -135,7 +135,7 @@ impl UnsafeArc { /// block; otherwise, an unwrapping task can be killed by linked failure. pub fn unwrap(self) -> T { unsafe { - let mut this = this; + let mut this = self; // The ~ dtor needs to run if this code succeeds. let mut data: ~ArcData = cast::transmute(this.data); // Set up the unwrap protocol. @@ -192,7 +192,7 @@ impl UnsafeArc { cast::forget(data); fail!("Another task is already unwrapping this Arc!"); } - }) + } } /// As unwrap above, but without blocking. Returns 'UnsafeArcSelf(self)' if this is diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 22cf57979a1..1d562d64849 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -863,11 +863,11 @@ pub trait ImmutableVector<'self, T> { /// Returns an iterator over the subslices of the vector which are /// separated by elements that match `pred`, limited to splitting /// at most `n` times. - fn splitn(self, n: uint, pred: |&T| -> bool) -> SplitIterator<'self, T>; + fn splitn(self, n: uint, pred: 'self |&T| -> bool) -> SplitIterator<'self, T>; /// Returns an iterator over the subslices of the vector which are /// separated by elements that match `pred`. This starts at the /// end of the vector and works backwards. - fn rsplit(self, pred: |&T| -> bool) -> RSplitIterator<'self, T>; + fn rsplit(self, pred: 'self |&T| -> bool) -> RSplitIterator<'self, T>; /// Returns an iterator over the subslices of the vector which are /// separated by elements that match `pred` limited to splitting /// at most `n` times. This starts at the end of the vector and diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs index ff3ab37b29c..57205ca2c58 100644 --- a/src/test/bench/core-set.rs +++ b/src/test/bench/core-set.rs @@ -1,3 +1,5 @@ +// xfail-pretty + // Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index 07e1b149932..da25f1e82ee 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -37,9 +37,9 @@ fn fib(n: int) -> int { let (pp, cc) = stream(); let cc = SharedChan::new(cc); let ch = cc.clone(); - task::spawn(|| pfib(&ch, n - 1) ); + task::spawn(proc() pfib(&ch, n - 1)); let ch = cc.clone(); - task::spawn(|| pfib(&ch, n - 2) ); + task::spawn(proc() pfib(&ch, n - 2)); c.send(pp.recv() + pp.recv()); } } diff --git a/src/test/bench/task-perf-spawnalot.rs b/src/test/bench/task-perf-spawnalot.rs index ef749960eb9..e322aceb5e6 100644 --- a/src/test/bench/task-perf-spawnalot.rs +++ b/src/test/bench/task-perf-spawnalot.rs @@ -15,7 +15,7 @@ use std::uint; fn f(n: uint) { let mut i = 0u; while i < n { - task::try(|| g() ); + task::try(proc() g()); i += 1u; } } diff --git a/src/test/debug-info/lexical-scope-in-unique-closure.rs b/src/test/debug-info/lexical-scope-in-unique-closure.rs index da9220322dd..2c732f9f850 100644 --- a/src/test/debug-info/lexical-scope-in-unique-closure.rs +++ b/src/test/debug-info/lexical-scope-in-unique-closure.rs @@ -51,7 +51,7 @@ fn main() { zzz(); sentinel(); - let unique_closure: proc(int) = |x| { + let unique_closure: proc(int) = proc(x) { zzz(); sentinel(); diff --git a/src/test/debug-info/var-captured-in-sendable-closure.rs b/src/test/debug-info/var-captured-in-sendable-closure.rs index 664e377c9fb..82618aa1f13 100644 --- a/src/test/debug-info/var-captured-in-sendable-closure.rs +++ b/src/test/debug-info/var-captured-in-sendable-closure.rs @@ -39,7 +39,7 @@ fn main() { let owned = ~5; - let closure: proc() = || { + let closure: proc() = proc() { zzz(); do_something(&constant, &a_struct.a, owned); }; diff --git a/src/test/pretty/disamb-stmt-expr.rs b/src/test/pretty/disamb-stmt-expr.rs index d3d6f1c0e35..78658a4c121 100644 --- a/src/test/pretty/disamb-stmt-expr.rs +++ b/src/test/pretty/disamb-stmt-expr.rs @@ -16,5 +16,5 @@ fn id(f: || -> int) -> int { f() } -fn wsucc(_n: int) -> int { (do id || { 1 }) - 0 } +fn wsucc(_n: int) -> int { id(|| { 1 }) - 0 } fn main() { } diff --git a/src/test/pretty/do1.rs b/src/test/pretty/do1.rs index 1fb2359da53..cd7a5b29a8a 100644 --- a/src/test/pretty/do1.rs +++ b/src/test/pretty/do1.rs @@ -12,4 +12,4 @@ fn f(f: |int|) { f(10) } -fn main() { do f |i| { assert!(i == 10) } } +fn main() { f(|i| { assert!(i == 10) }) } diff --git a/src/test/run-pass/borrowck-preserve-box-in-field.rs b/src/test/run-pass/borrowck-preserve-box-in-field.rs index 506d777013c..1caf5c03376 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-field.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-field.rs @@ -1,3 +1,5 @@ +// xfail-pretty + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/borrowck-preserve-box-in-uniq.rs b/src/test/run-pass/borrowck-preserve-box-in-uniq.rs index d7f7a8e47a2..2b8180be00e 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-uniq.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-uniq.rs @@ -1,3 +1,5 @@ +// xfail-pretty + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/borrowck-preserve-box.rs b/src/test/run-pass/borrowck-preserve-box.rs index feea06cd69a..2acaf54f05f 100644 --- a/src/test/run-pass/borrowck-preserve-box.rs +++ b/src/test/run-pass/borrowck-preserve-box.rs @@ -1,3 +1,5 @@ +// xfail-pretty + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/borrowck-preserve-expl-deref.rs b/src/test/run-pass/borrowck-preserve-expl-deref.rs index d131a529f1a..4400b03e313 100644 --- a/src/test/run-pass/borrowck-preserve-expl-deref.rs +++ b/src/test/run-pass/borrowck-preserve-expl-deref.rs @@ -1,3 +1,5 @@ +// xfail-pretty + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT.