librustc: Fix merge fallout.

This commit is contained in:
Patrick Walton 2013-11-24 11:44:28 -08:00
parent 151b7ed52d
commit 9521551b47
24 changed files with 43 additions and 59 deletions

View File

@ -1983,7 +1983,7 @@ mod tests {
}
fn check_err<T: Decodable<Decoder>>(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),

View File

@ -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(),
}
})
})

View File

@ -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();
}

View File

@ -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, _: ()) {

View File

@ -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() {

View File

@ -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);

View File

@ -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)),

View File

@ -168,28 +168,6 @@ impl<T> Drop for Rc<T> {
}
}
impl<T> Clone for RcMut<T> {
/// Return a shallow copy of the reference counted pointer.
#[inline]
fn clone(&self) -> RcMut<T> {
unsafe {
(*self.ptr).count += 1;
RcMut{ptr: self.ptr}
}
}
}
impl<T: DeepClone> DeepClone for RcMut<T> {
/// Return a deep copy of the reference counted pointer.
#[inline]
fn deep_clone(&self) -> RcMut<T> {
self.with_borrow(|x| {
// FIXME: #6497: should avoid freeze (slow)
unsafe { RcMut::new_unchecked(x.deep_clone()) }
})
}
}
#[cfg(test)]
mod test_rc {
use super::*;

View File

@ -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 => ()
}
}
})
}
}
}

View File

@ -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]

View File

@ -76,7 +76,7 @@ pub fn select<A: 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

View File

@ -135,7 +135,7 @@ impl<T: Send> UnsafeArc<T> {
/// 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<T> = cast::transmute(this.data);
// Set up the unwrap protocol.
@ -192,7 +192,7 @@ impl<T: Send> UnsafeArc<T> {
cast::forget(data);
fail!("Another task is already unwrapping this Arc!");
}
})
}
}
/// As unwrap above, but without blocking. Returns 'UnsafeArcSelf(self)' if this is

View File

@ -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

View File

@ -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.

View File

@ -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());
}
}

View File

@ -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;
}
}

View File

@ -51,7 +51,7 @@ fn main() {
zzz();
sentinel();
let unique_closure: proc(int) = |x| {
let unique_closure: proc(int) = proc(x) {
zzz();
sentinel();

View File

@ -39,7 +39,7 @@ fn main() {
let owned = ~5;
let closure: proc() = || {
let closure: proc() = proc() {
zzz();
do_something(&constant, &a_struct.a, owned);
};

View File

@ -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() { }

View File

@ -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) }) }

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.