Rollup test fixes and rebase conflicts
This commit is contained in:
parent
1f2ead1629
commit
e921e3f045
31 changed files with 56 additions and 95 deletions
|
@ -3177,7 +3177,6 @@ then the expression completes.
|
|||
Some examples of call expressions:
|
||||
|
||||
```
|
||||
# use std::str::from_str;
|
||||
# fn add(x: int, y: int) -> int { 0 }
|
||||
|
||||
let x: int = add(1, 2);
|
||||
|
|
|
@ -113,28 +113,9 @@ impl<S: hash::Writer, Sized? T: Hash<S>> Hash<S> for Box<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))]
|
||||
impl Box<Any> {
|
||||
pub fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any>> {
|
||||
if self.is::<T>() {
|
||||
unsafe {
|
||||
// Get the raw representation of the trait object
|
||||
let to: TraitObject =
|
||||
mem::transmute::<Box<Any>, TraitObject>(self);
|
||||
|
||||
// Extract the data pointer
|
||||
Ok(mem::transmute(to.data))
|
||||
}
|
||||
} else {
|
||||
Err(self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Extension methods for an owning `Any` trait object.
|
||||
#[unstable = "post-DST and coherence changes, this will not be a trait but \
|
||||
rather a direct `impl` on `Box<Any>`"]
|
||||
#[cfg(stage0)]
|
||||
pub trait BoxAny {
|
||||
/// Returns the boxed value if it is of type `T`, or
|
||||
/// `Err(Self)` if it isn't.
|
||||
|
@ -142,10 +123,10 @@ pub trait BoxAny {
|
|||
fn downcast<T: 'static>(self) -> Result<Box<T>, Self>;
|
||||
}
|
||||
|
||||
#[stable]
|
||||
#[cfg(stage0)]
|
||||
impl BoxAny for Box<Any> {
|
||||
#[inline]
|
||||
#[unstable = "method may be renamed with respect to other downcasting \
|
||||
methods"]
|
||||
fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any>> {
|
||||
if self.is::<T>() {
|
||||
unsafe {
|
||||
|
|
|
@ -92,7 +92,7 @@ use core::iter::{Chain, Enumerate, Repeat, Skip, Take, repeat, Cloned};
|
|||
use core::iter::{mod, FromIterator};
|
||||
use core::num::Int;
|
||||
use core::ops::Index;
|
||||
use core::slice::{Iter, IterMut};
|
||||
use core::slice;
|
||||
use core::{u8, u32, uint};
|
||||
use bitv_set; //so meta
|
||||
|
||||
|
|
|
@ -723,8 +723,6 @@ impl<T: Default> Option<T> {
|
|||
/// `None` on error.
|
||||
///
|
||||
/// ```
|
||||
/// use std::str::from_str;
|
||||
///
|
||||
/// let good_year_from_input = "1909";
|
||||
/// let bad_year_from_input = "190blarg";
|
||||
/// let good_year = good_year_from_input.parse().unwrap_or_default();
|
||||
|
|
|
@ -449,7 +449,6 @@ impl<T, E> Result<T, E> {
|
|||
///
|
||||
/// ```
|
||||
/// use std::io::IoResult;
|
||||
/// use std::str::from_str;
|
||||
///
|
||||
/// let mut buffer = &mut b"1\n2\n3\n4\n";
|
||||
///
|
||||
|
|
|
@ -23,7 +23,6 @@ use syntax::diagnostic;
|
|||
use syntax::diagnostic::{Emitter, Handler, Level, mk_handler};
|
||||
|
||||
use std::c_str::{ToCStr, CString};
|
||||
use std::comm::channel;
|
||||
use std::io::Command;
|
||||
use std::io::fs;
|
||||
use std::iter::Unfold;
|
||||
|
|
|
@ -402,7 +402,7 @@ fn escape_str(wr: &mut fmt::Writer, v: &str) -> fmt::Result {
|
|||
}
|
||||
|
||||
fn escape_char(writer: &mut fmt::Writer, v: char) -> fmt::Result {
|
||||
let mut buf = [0, .. 4];
|
||||
let mut buf = [0; 4];
|
||||
let n = v.encode_utf8(&mut buf).unwrap();
|
||||
let buf = unsafe { str::from_utf8_unchecked(buf[0..n]) };
|
||||
escape_str(writer, buf)
|
||||
|
|
|
@ -1918,7 +1918,7 @@ impl fmt::Show for FilePermission {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use self::BadReaderBehavior::*;
|
||||
use super::{IoResult, Reader, MemReader, NoProgress, InvalidInput};
|
||||
use super::{IoResult, MemReader, NoProgress, InvalidInput};
|
||||
use prelude::v1::*;
|
||||
use uint;
|
||||
|
||||
|
|
|
@ -225,8 +225,6 @@ fn in_ms_u64(d: Duration) -> u64 {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use prelude::v1::*;
|
||||
|
||||
use super::Timer;
|
||||
use thread::Thread;
|
||||
use time::Duration;
|
||||
|
|
|
@ -1119,10 +1119,6 @@ fn prefix_len(p: Option<PathPrefix>) -> uint {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::v1::Option::{mod, Some, None};
|
||||
use prelude::v1::{Vec, Clone, AsSlice, SliceExt, CloneSliceExt, IteratorExt};
|
||||
use prelude::v1::{DoubleEndedIteratorExt, Str, ToString, GenericPath};
|
||||
|
||||
use super::PathPrefix::*;
|
||||
use super::parse_prefix;
|
||||
use super::*;
|
||||
|
|
|
@ -307,7 +307,7 @@ mod tests {
|
|||
static C: StaticCondvar = CONDVAR_INIT;
|
||||
static M: StaticMutex = MUTEX_INIT;
|
||||
|
||||
let mut g = M.lock().unwrap();
|
||||
let g = M.lock().unwrap();
|
||||
let _t = Thread::spawn(move|| {
|
||||
let _g = M.lock().unwrap();
|
||||
C.notify_one();
|
||||
|
@ -386,6 +386,6 @@ mod tests {
|
|||
g = C.wait(g).unwrap();
|
||||
drop(g);
|
||||
|
||||
C.wait(M2.lock().unwrap()).unwrap();
|
||||
let _ = C.wait(M2.lock().unwrap()).unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -337,7 +337,6 @@ mod test {
|
|||
use prelude::v1::*;
|
||||
|
||||
use thread::Thread;
|
||||
use super::*;
|
||||
use sync::mpsc::*;
|
||||
|
||||
// Don't use the libstd version so we can pull in the right Select structure
|
||||
|
|
|
@ -447,7 +447,7 @@ mod test {
|
|||
fn test_mutex_arc_poison() {
|
||||
let arc = Arc::new(Mutex::new(1i));
|
||||
let arc2 = arc.clone();
|
||||
Thread::spawn(move|| {
|
||||
let _ = Thread::spawn(move|| {
|
||||
let lock = arc2.lock().unwrap();
|
||||
assert_eq!(*lock, 2);
|
||||
}).join();
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
use prelude::v1::*;
|
||||
|
||||
use cell::UnsafeCell;
|
||||
use comm::{channel, Sender, Receiver};
|
||||
use mem;
|
||||
use rt;
|
||||
use sync::{StaticMutex, StaticCondvar};
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
use prelude::v1::*;
|
||||
|
||||
use prelude::*;
|
||||
|
||||
use libc;
|
||||
use c_str::CString;
|
||||
use mem;
|
||||
|
|
|
@ -24,13 +24,12 @@ use num;
|
|||
use mem;
|
||||
use io::{mod, IoResult, IoError};
|
||||
use sync::{Once, ONCE_INIT};
|
||||
use comm::Sender;
|
||||
|
||||
macro_rules! helper_init { (static $name:ident: Helper<$m:ty>) => (
|
||||
static $name: Helper<$m> = Helper {
|
||||
lock: ::sync::MUTEX_INIT,
|
||||
cond: ::sync::CONDVAR_INIT,
|
||||
chan: ::cell::UnsafeCell { value: 0 as *mut Sender<$m> },
|
||||
chan: ::cell::UnsafeCell { value: 0 as *mut ::sync::mpsc::Sender<$m> },
|
||||
signal: ::cell::UnsafeCell { value: 0 },
|
||||
initialized: ::cell::UnsafeCell { value: false },
|
||||
shutdown: ::cell::UnsafeCell { value: false },
|
||||
|
|
|
@ -25,10 +25,9 @@ use prelude::v1::*;
|
|||
|
||||
use libc;
|
||||
use ptr;
|
||||
use comm;
|
||||
|
||||
use comm::{channel, Sender, Receiver};
|
||||
use io::IoResult;
|
||||
use sync::mpsc::{channel, Sender, Receiver, TryRecvError};
|
||||
use sys::c;
|
||||
use sys::fs::FileDesc;
|
||||
use sys_common::helper_thread::Helper;
|
||||
|
@ -72,7 +71,7 @@ fn helper(input: libc::HANDLE, messages: Receiver<Req>, _: ()) {
|
|||
chans.push((c, one));
|
||||
}
|
||||
Ok(RemoveTimer(obj, c)) => {
|
||||
c.send(());
|
||||
c.send(()).unwrap();
|
||||
match objs.iter().position(|&o| o == obj) {
|
||||
Some(i) => {
|
||||
drop(objs.remove(i));
|
||||
|
@ -81,7 +80,7 @@ fn helper(input: libc::HANDLE, messages: Receiver<Req>, _: ()) {
|
|||
None => {}
|
||||
}
|
||||
}
|
||||
Err(comm::Disconnected) => {
|
||||
Err(TryRecvError::Disconnected) => {
|
||||
assert_eq!(objs.len(), 1);
|
||||
assert_eq!(chans.len(), 0);
|
||||
break 'outer;
|
||||
|
@ -133,7 +132,7 @@ impl Timer {
|
|||
|
||||
let (tx, rx) = channel();
|
||||
HELPER.send(RemoveTimer(self.obj, tx));
|
||||
rx.recv();
|
||||
rx.recv().unwrap();
|
||||
|
||||
self.on_worker = false;
|
||||
}
|
||||
|
|
|
@ -443,8 +443,8 @@ mod test {
|
|||
use prelude::v1::*;
|
||||
|
||||
use any::{Any, AnyRefExt};
|
||||
use boxed::BoxAny;
|
||||
use sync::mpsc::{channel, Sender};
|
||||
use boxed::BoxAny;
|
||||
use result;
|
||||
use std::io::{ChanReader, ChanWriter};
|
||||
use super::{Thread, Builder};
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
// different scalability characteristics compared to the select
|
||||
// version.
|
||||
|
||||
use std::comm::{channel, Sender, Receiver};
|
||||
use std::comm;
|
||||
use std::sync::mpsc::{channel, Sender, Receiver};
|
||||
use std::os;
|
||||
use std::str::from_str;
|
||||
use std::thread::Thread;
|
||||
|
@ -38,8 +37,8 @@ fn server(requests: &Receiver<request>, responses: &Sender<uint>) {
|
|||
let mut count = 0u;
|
||||
let mut done = false;
|
||||
while !done {
|
||||
match requests.recv_opt() {
|
||||
Ok(request::get_count) => { responses.send(count.clone()); }
|
||||
match requests.recv() {
|
||||
Ok(request::get_count) => { responses.send(count.clone()).unwrap(); }
|
||||
Ok(request::bytes(b)) => {
|
||||
//println!("server: received {} bytes", b);
|
||||
count += b;
|
||||
|
@ -48,7 +47,7 @@ fn server(requests: &Receiver<request>, responses: &Sender<uint>) {
|
|||
_ => { }
|
||||
}
|
||||
}
|
||||
responses.send(count);
|
||||
responses.send(count).unwrap();
|
||||
//println!("server exiting");
|
||||
}
|
||||
|
||||
|
@ -69,7 +68,7 @@ fn run(args: &[String]) {
|
|||
worker_results.push(Thread::spawn(move|| {
|
||||
for _ in range(0u, size / workers) {
|
||||
//println!("worker {}: sending {} bytes", i, num_bytes);
|
||||
to_child.send(request::bytes(num_bytes));
|
||||
to_child.send(request::bytes(num_bytes)).unwrap();
|
||||
}
|
||||
//println!("worker {} exiting", i);
|
||||
}));
|
||||
|
@ -83,9 +82,9 @@ fn run(args: &[String]) {
|
|||
}
|
||||
|
||||
//println!("sending stop message");
|
||||
to_child.send(request::stop);
|
||||
to_child.send(request::stop).unwrap();
|
||||
move_out(to_child);
|
||||
result = Some(from_child.recv());
|
||||
result = Some(from_child.recv().unwrap());
|
||||
});
|
||||
let result = result.unwrap();
|
||||
print!("Count is {}\n", result);
|
||||
|
|
|
@ -14,9 +14,8 @@
|
|||
//
|
||||
// I *think* it's the same, more or less.
|
||||
|
||||
use std::comm::{channel, Sender, Receiver};
|
||||
use std::sync::mpsc::{channel, Sender, Receiver};
|
||||
use std::os;
|
||||
use std::str::from_str;
|
||||
use std::thread::Thread;
|
||||
use std::time::Duration;
|
||||
use std::uint;
|
||||
|
@ -33,7 +32,7 @@ fn server(requests: &Receiver<request>, responses: &Sender<uint>) {
|
|||
let mut count: uint = 0;
|
||||
let mut done = false;
|
||||
while !done {
|
||||
match requests.recv_opt() {
|
||||
match requests.recv() {
|
||||
Ok(request::get_count) => { responses.send(count.clone()); }
|
||||
Ok(request::bytes(b)) => {
|
||||
//println!("server: received {} bytes", b);
|
||||
|
@ -50,8 +49,8 @@ fn server(requests: &Receiver<request>, responses: &Sender<uint>) {
|
|||
fn run(args: &[String]) {
|
||||
let (to_parent, from_child) = channel();
|
||||
|
||||
let size = from_str::<uint>(args[1].as_slice()).unwrap();
|
||||
let workers = from_str::<uint>(args[2].as_slice()).unwrap();
|
||||
let size = args[1].parse::<uint>().unwrap();
|
||||
let workers = args[2].parse::<uint>().unwrap();
|
||||
let num_bytes = 100;
|
||||
let mut result = None;
|
||||
let mut to_parent = Some(to_parent);
|
||||
|
@ -93,7 +92,7 @@ fn run(args: &[String]) {
|
|||
//println!("sending stop message");
|
||||
//to_child.send(stop);
|
||||
//move_out(to_child);
|
||||
result = Some(from_child.recv());
|
||||
result = Some(from_child.recv().unwrap());
|
||||
});
|
||||
let result = result.unwrap();
|
||||
print!("Count is {}\n", result);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::comm::channel;
|
||||
use std::sync::mpsc::channel;
|
||||
use std::os;
|
||||
use std::str::from_str;
|
||||
use std::thread::Thread;
|
||||
|
|
|
@ -8,9 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::comm::channel;
|
||||
use std::sync::mpsc::channel;
|
||||
use std::os;
|
||||
use std::str::from_str;
|
||||
use std::thread::Thread;
|
||||
use std::uint;
|
||||
|
||||
|
@ -28,7 +27,7 @@ fn parfib(n: uint) -> uint {
|
|||
tx.send(parfib(n-1));
|
||||
}).detach();
|
||||
let m2 = parfib(n-2);
|
||||
return (rx.recv() + m2);
|
||||
return (rx.recv().unwrap() + m2);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -36,7 +35,7 @@ fn main() {
|
|||
let args = os::args();
|
||||
let args = args.as_slice();
|
||||
let n = if args.len() == 2 {
|
||||
from_str::<uint>(args[1].as_slice()).unwrap()
|
||||
args[1].parse::<uint>().unwrap()
|
||||
} else {
|
||||
10
|
||||
};
|
||||
|
|
|
@ -75,7 +75,7 @@ fn main() {
|
|||
} else if args.len() <= 1u {
|
||||
8
|
||||
} else {
|
||||
from_str(args[1].as_slice()).unwrap()
|
||||
args[1].parse().unwrap()
|
||||
};
|
||||
let min_depth = 4;
|
||||
let max_depth = if min_depth + 2 > n {min_depth + 2} else {n};
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
// no-pretty-expanded
|
||||
|
||||
use self::Color::{Red, Yellow, Blue};
|
||||
use std::comm::{channel, Sender, Receiver};
|
||||
use std::sync::mpsc::{channel, Sender, Receiver};
|
||||
use std::fmt;
|
||||
use std::str::from_str;
|
||||
use std::thread::Thread;
|
||||
|
@ -154,7 +154,7 @@ fn creature(
|
|||
|
||||
loop {
|
||||
// ask for a pairing
|
||||
to_rendezvous.send(CreatureInfo {name: name, color: color});
|
||||
to_rendezvous.send(CreatureInfo {name: name, color: color}).unwrap();
|
||||
|
||||
// log and change, or quit
|
||||
match rendezvous.next() {
|
||||
|
@ -172,7 +172,7 @@ fn creature(
|
|||
}
|
||||
// log creatures met and evil clones of self
|
||||
let report = format!("{}{}", creatures_met, Number(evil_clones_met));
|
||||
to_rendezvous_log.send(report);
|
||||
to_rendezvous_log.send(report).unwrap();
|
||||
}
|
||||
|
||||
fn rendezvous(nn: uint, set: Vec<Color>) {
|
||||
|
@ -204,13 +204,13 @@ fn rendezvous(nn: uint, set: Vec<Color>) {
|
|||
|
||||
// set up meetings...
|
||||
for _ in range(0, nn) {
|
||||
let fst_creature = from_creatures.recv();
|
||||
let snd_creature = from_creatures.recv();
|
||||
let fst_creature = from_creatures.recv().unwrap();
|
||||
let snd_creature = from_creatures.recv().unwrap();
|
||||
|
||||
creatures_met += 2;
|
||||
|
||||
to_creature[fst_creature.name].send(snd_creature);
|
||||
to_creature[snd_creature.name].send(fst_creature);
|
||||
to_creature[fst_creature.name].send(snd_creature).unwrap();
|
||||
to_creature[snd_creature.name].send(fst_creature).unwrap();
|
||||
}
|
||||
|
||||
// tell each creature to stop
|
||||
|
|
|
@ -186,7 +186,7 @@ fn fannkuch(n: i32) -> (i32, i32) {
|
|||
fn main() {
|
||||
let n = std::os::args().as_slice()
|
||||
.get(1)
|
||||
.and_then(|arg| from_str(arg.as_slice()))
|
||||
.and_then(|arg| arg.parse())
|
||||
.unwrap_or(2i32);
|
||||
|
||||
let (checksum, maxflips) = fannkuch(n);
|
||||
|
|
|
@ -20,7 +20,7 @@ extern crate collections;
|
|||
use std::ascii::{AsciiExt, OwnedAsciiExt};
|
||||
use std::cmp::Ordering::{mod, Less, Greater, Equal};
|
||||
use std::collections::HashMap;
|
||||
use std::comm::{channel, Sender, Receiver};
|
||||
use std::sync::mpsc::{channel, Sender, Receiver};
|
||||
use std::mem::replace;
|
||||
use std::num::Float;
|
||||
use std::option;
|
||||
|
@ -120,7 +120,7 @@ fn make_sequence_processor(sz: uint,
|
|||
|
||||
loop {
|
||||
|
||||
line = from_parent.recv();
|
||||
line = from_parent.recv().unwrap();
|
||||
if line == Vec::new() { break; }
|
||||
|
||||
carry.push_all(line.as_slice());
|
||||
|
@ -222,6 +222,6 @@ fn main() {
|
|||
|
||||
// now fetch and print result messages
|
||||
for (ii, _sz) in sizes.iter().enumerate() {
|
||||
println!("{}", from_child[ii].recv());
|
||||
println!("{}", from_child[ii].recv().unwrap());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
// no-pretty-expanded FIXME #15189
|
||||
|
||||
use std::comm::channel;
|
||||
use std::sync::mpsc::channel;
|
||||
use std::sync::Arc;
|
||||
use std::thread::Thread;
|
||||
|
||||
|
@ -315,13 +315,13 @@ fn par_search(masks: Vec<Vec<Vec<u64>>>) -> Data {
|
|||
Thread::spawn(move|| {
|
||||
let mut data = Data::new();
|
||||
search(&*masks, m, 1, List::Cons(m, &List::Nil), &mut data);
|
||||
tx.send(data);
|
||||
tx.send(data).unwrap();
|
||||
}).detach();
|
||||
}
|
||||
|
||||
// collecting the results
|
||||
drop(tx);
|
||||
let mut data = rx.recv();
|
||||
let mut data = rx.recv().unwrap();
|
||||
for d in rx.iter() { data.reduce_from(d); }
|
||||
data
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
use std::comm::{channel, Sender};
|
||||
use std::sync::mpsc::{channel, Sender};
|
||||
use std::os;
|
||||
use std::result::Result::{Ok, Err};
|
||||
use std::str::from_str;
|
||||
|
@ -30,22 +30,22 @@ use std::time::Duration;
|
|||
fn fib(n: int) -> int {
|
||||
fn pfib(tx: &Sender<int>, n: int) {
|
||||
if n == 0 {
|
||||
tx.send(0);
|
||||
tx.send(0).unwrap();
|
||||
} else if n <= 2 {
|
||||
tx.send(1);
|
||||
tx.send(1).unwrap();
|
||||
} else {
|
||||
let (tx1, rx) = channel();
|
||||
let tx2 = tx1.clone();
|
||||
Thread::spawn(move|| pfib(&tx2, n - 1)).detach();
|
||||
let tx2 = tx1.clone();
|
||||
Thread::spawn(move|| pfib(&tx2, n - 2)).detach();
|
||||
tx.send(rx.recv() + rx.recv());
|
||||
tx.send(rx.recv().unwrap() + rx.recv().unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
let (tx, rx) = channel();
|
||||
Thread::spawn(move|| pfib(&tx, n) ).detach();
|
||||
rx.recv()
|
||||
rx.recv().unwrap()
|
||||
}
|
||||
|
||||
struct Config {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
// OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
use std::comm::{channel, Sender, Receiver};
|
||||
use std::sync::mpsc::{channel, Sender, Receiver};
|
||||
use std::str::from_str;
|
||||
use std::thread::Thread;
|
||||
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
|
||||
// ignore-pretty very bad with line comments
|
||||
|
||||
use std::comm::{mod, channel};
|
||||
use std::sync::mpsc::{channel, Sender};
|
||||
use std::os;
|
||||
use std::str::from_str;
|
||||
use std::task;
|
||||
use std::thread::Thread;
|
||||
use std::uint;
|
||||
|
||||
fn child_generation(gens_left: uint, tx: comm::Sender<()>) {
|
||||
fn child_generation(gens_left: uint, tx: Sender<()>) {
|
||||
// This used to be O(n^2) in the number of generations that ever existed.
|
||||
// With this code, only as many generations are alive at a time as tasks
|
||||
// alive at a time,
|
||||
|
@ -35,7 +35,7 @@ fn child_generation(gens_left: uint, tx: comm::Sender<()>) {
|
|||
if gens_left > 0 {
|
||||
child_generation(gens_left - 1, tx); // recurse
|
||||
} else {
|
||||
tx.send(())
|
||||
tx.send(()).unwrap()
|
||||
}
|
||||
}).detach();
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ fn main() {
|
|||
|
||||
let (tx, rx) = channel();
|
||||
child_generation(from_str::<uint>(args[1].as_slice()).unwrap(), tx);
|
||||
if rx.recv_opt().is_err() {
|
||||
if rx.recv().is_err() {
|
||||
panic!("it happened when we slumbered");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ trait From<Src> {
|
|||
trait To {
|
||||
// This is a typo, the return type should be `<Dst as From<Self>>::Output`
|
||||
fn to<Dst: From<Self>>(self) -> <Dst as From<Self>>::Dst {
|
||||
//~ error: the trait `core::kinds::Sized` is not implemented
|
||||
//~^ error: the trait `core::kinds::Sized` is not implemented
|
||||
From::from(self)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue