Skip to content

Commit e921e3f

Browse files
committed
Rollup test fixes and rebase conflicts
1 parent 1f2ead1 commit e921e3f

31 files changed

+56
-95
lines changed

src/doc/reference.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3177,7 +3177,6 @@ then the expression completes.
31773177
Some examples of call expressions:
31783178

31793179
```
3180-
# use std::str::from_str;
31813180
# fn add(x: int, y: int) -> int { 0 }
31823181
31833182
let x: int = add(1, 2);

src/liballoc/boxed.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -113,39 +113,20 @@ impl<S: hash::Writer, Sized? T: Hash<S>> Hash<S> for Box<T> {
113113
}
114114
}
115115

116-
#[cfg(not(stage0))]
117-
impl Box<Any> {
118-
pub fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any>> {
119-
if self.is::<T>() {
120-
unsafe {
121-
// Get the raw representation of the trait object
122-
let to: TraitObject =
123-
mem::transmute::<Box<Any>, TraitObject>(self);
124-
125-
// Extract the data pointer
126-
Ok(mem::transmute(to.data))
127-
}
128-
} else {
129-
Err(self)
130-
}
131-
}
132-
}
133-
134116
/// Extension methods for an owning `Any` trait object.
135117
#[unstable = "post-DST and coherence changes, this will not be a trait but \
136118
rather a direct `impl` on `Box<Any>`"]
137-
#[cfg(stage0)]
138119
pub trait BoxAny {
139120
/// Returns the boxed value if it is of type `T`, or
140121
/// `Err(Self)` if it isn't.
141122
#[stable]
142123
fn downcast<T: 'static>(self) -> Result<Box<T>, Self>;
143124
}
144125

145-
#[stable]
146-
#[cfg(stage0)]
147126
impl BoxAny for Box<Any> {
148127
#[inline]
128+
#[unstable = "method may be renamed with respect to other downcasting \
129+
methods"]
149130
fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any>> {
150131
if self.is::<T>() {
151132
unsafe {

src/libcollections/bit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ use core::iter::{Chain, Enumerate, Repeat, Skip, Take, repeat, Cloned};
9292
use core::iter::{mod, FromIterator};
9393
use core::num::Int;
9494
use core::ops::Index;
95-
use core::slice::{Iter, IterMut};
95+
use core::slice;
9696
use core::{u8, u32, uint};
9797
use bitv_set; //so meta
9898

src/libcore/option.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,8 +723,6 @@ impl<T: Default> Option<T> {
723723
/// `None` on error.
724724
///
725725
/// ```
726-
/// use std::str::from_str;
727-
///
728726
/// let good_year_from_input = "1909";
729727
/// let bad_year_from_input = "190blarg";
730728
/// let good_year = good_year_from_input.parse().unwrap_or_default();

src/libcore/result.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,6 @@ impl<T, E> Result<T, E> {
449449
///
450450
/// ```
451451
/// use std::io::IoResult;
452-
/// use std::str::from_str;
453452
///
454453
/// let mut buffer = &mut b"1\n2\n3\n4\n";
455454
///

src/librustc_trans/back/write.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use syntax::diagnostic;
2323
use syntax::diagnostic::{Emitter, Handler, Level, mk_handler};
2424

2525
use std::c_str::{ToCStr, CString};
26-
use std::comm::channel;
2726
use std::io::Command;
2827
use std::io::fs;
2928
use std::iter::Unfold;

src/libserialize/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ fn escape_str(wr: &mut fmt::Writer, v: &str) -> fmt::Result {
402402
}
403403

404404
fn escape_char(writer: &mut fmt::Writer, v: char) -> fmt::Result {
405-
let mut buf = [0, .. 4];
405+
let mut buf = [0; 4];
406406
let n = v.encode_utf8(&mut buf).unwrap();
407407
let buf = unsafe { str::from_utf8_unchecked(buf[0..n]) };
408408
escape_str(writer, buf)

src/libstd/io/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,7 @@ impl fmt::Show for FilePermission {
19181918
#[cfg(test)]
19191919
mod tests {
19201920
use self::BadReaderBehavior::*;
1921-
use super::{IoResult, Reader, MemReader, NoProgress, InvalidInput};
1921+
use super::{IoResult, MemReader, NoProgress, InvalidInput};
19221922
use prelude::v1::*;
19231923
use uint;
19241924

src/libstd/io/timer.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,6 @@ fn in_ms_u64(d: Duration) -> u64 {
225225

226226
#[cfg(test)]
227227
mod test {
228-
use prelude::v1::*;
229-
230228
use super::Timer;
231229
use thread::Thread;
232230
use time::Duration;

src/libstd/path/windows.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,10 +1119,6 @@ fn prefix_len(p: Option<PathPrefix>) -> uint {
11191119

11201120
#[cfg(test)]
11211121
mod tests {
1122-
use prelude::v1::Option::{mod, Some, None};
1123-
use prelude::v1::{Vec, Clone, AsSlice, SliceExt, CloneSliceExt, IteratorExt};
1124-
use prelude::v1::{DoubleEndedIteratorExt, Str, ToString, GenericPath};
1125-
11261122
use super::PathPrefix::*;
11271123
use super::parse_prefix;
11281124
use super::*;

src/libstd/sync/condvar.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ mod tests {
307307
static C: StaticCondvar = CONDVAR_INIT;
308308
static M: StaticMutex = MUTEX_INIT;
309309

310-
let mut g = M.lock().unwrap();
310+
let g = M.lock().unwrap();
311311
let _t = Thread::spawn(move|| {
312312
let _g = M.lock().unwrap();
313313
C.notify_one();
@@ -386,6 +386,6 @@ mod tests {
386386
g = C.wait(g).unwrap();
387387
drop(g);
388388

389-
C.wait(M2.lock().unwrap()).unwrap();
389+
let _ = C.wait(M2.lock().unwrap()).unwrap();
390390
}
391391
}

src/libstd/sync/mpsc/select.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ mod test {
337337
use prelude::v1::*;
338338

339339
use thread::Thread;
340-
use super::*;
341340
use sync::mpsc::*;
342341

343342
// Don't use the libstd version so we can pull in the right Select structure

src/libstd/sync/mutex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ mod test {
447447
fn test_mutex_arc_poison() {
448448
let arc = Arc::new(Mutex::new(1i));
449449
let arc2 = arc.clone();
450-
Thread::spawn(move|| {
450+
let _ = Thread::spawn(move|| {
451451
let lock = arc2.lock().unwrap();
452452
assert_eq!(*lock, 2);
453453
}).join();

src/libstd/sys/common/helper_thread.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
use prelude::v1::*;
2424

2525
use cell::UnsafeCell;
26-
use comm::{channel, Sender, Receiver};
2726
use mem;
2827
use rt;
2928
use sync::{StaticMutex, StaticCondvar};

src/libstd/sys/unix/pipe.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
use prelude::v1::*;
1212

13-
use prelude::*;
14-
1513
use libc;
1614
use c_str::CString;
1715
use mem;

src/libstd/sys/windows/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ use num;
2424
use mem;
2525
use io::{mod, IoResult, IoError};
2626
use sync::{Once, ONCE_INIT};
27-
use comm::Sender;
2827

2928
macro_rules! helper_init { (static $name:ident: Helper<$m:ty>) => (
3029
static $name: Helper<$m> = Helper {
3130
lock: ::sync::MUTEX_INIT,
3231
cond: ::sync::CONDVAR_INIT,
33-
chan: ::cell::UnsafeCell { value: 0 as *mut Sender<$m> },
32+
chan: ::cell::UnsafeCell { value: 0 as *mut ::sync::mpsc::Sender<$m> },
3433
signal: ::cell::UnsafeCell { value: 0 },
3534
initialized: ::cell::UnsafeCell { value: false },
3635
shutdown: ::cell::UnsafeCell { value: false },

src/libstd/sys/windows/timer.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ use prelude::v1::*;
2525

2626
use libc;
2727
use ptr;
28-
use comm;
2928

30-
use comm::{channel, Sender, Receiver};
3129
use io::IoResult;
30+
use sync::mpsc::{channel, Sender, Receiver, TryRecvError};
3231
use sys::c;
3332
use sys::fs::FileDesc;
3433
use sys_common::helper_thread::Helper;
@@ -72,7 +71,7 @@ fn helper(input: libc::HANDLE, messages: Receiver<Req>, _: ()) {
7271
chans.push((c, one));
7372
}
7473
Ok(RemoveTimer(obj, c)) => {
75-
c.send(());
74+
c.send(()).unwrap();
7675
match objs.iter().position(|&o| o == obj) {
7776
Some(i) => {
7877
drop(objs.remove(i));
@@ -81,7 +80,7 @@ fn helper(input: libc::HANDLE, messages: Receiver<Req>, _: ()) {
8180
None => {}
8281
}
8382
}
84-
Err(comm::Disconnected) => {
83+
Err(TryRecvError::Disconnected) => {
8584
assert_eq!(objs.len(), 1);
8685
assert_eq!(chans.len(), 0);
8786
break 'outer;
@@ -133,7 +132,7 @@ impl Timer {
133132

134133
let (tx, rx) = channel();
135134
HELPER.send(RemoveTimer(self.obj, tx));
136-
rx.recv();
135+
rx.recv().unwrap();
137136

138137
self.on_worker = false;
139138
}

src/libstd/thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ mod test {
443443
use prelude::v1::*;
444444

445445
use any::{Any, AnyRefExt};
446-
use boxed::BoxAny;
447446
use sync::mpsc::{channel, Sender};
447+
use boxed::BoxAny;
448448
use result;
449449
use std::io::{ChanReader, ChanWriter};
450450
use super::{Thread, Builder};

src/test/bench/msgsend-pipes-shared.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
// different scalability characteristics compared to the select
1919
// version.
2020

21-
use std::comm::{channel, Sender, Receiver};
22-
use std::comm;
21+
use std::sync::mpsc::{channel, Sender, Receiver};
2322
use std::os;
2423
use std::str::from_str;
2524
use std::thread::Thread;
@@ -38,8 +37,8 @@ fn server(requests: &Receiver<request>, responses: &Sender<uint>) {
3837
let mut count = 0u;
3938
let mut done = false;
4039
while !done {
41-
match requests.recv_opt() {
42-
Ok(request::get_count) => { responses.send(count.clone()); }
40+
match requests.recv() {
41+
Ok(request::get_count) => { responses.send(count.clone()).unwrap(); }
4342
Ok(request::bytes(b)) => {
4443
//println!("server: received {} bytes", b);
4544
count += b;
@@ -48,7 +47,7 @@ fn server(requests: &Receiver<request>, responses: &Sender<uint>) {
4847
_ => { }
4948
}
5049
}
51-
responses.send(count);
50+
responses.send(count).unwrap();
5251
//println!("server exiting");
5352
}
5453

@@ -69,7 +68,7 @@ fn run(args: &[String]) {
6968
worker_results.push(Thread::spawn(move|| {
7069
for _ in range(0u, size / workers) {
7170
//println!("worker {}: sending {} bytes", i, num_bytes);
72-
to_child.send(request::bytes(num_bytes));
71+
to_child.send(request::bytes(num_bytes)).unwrap();
7372
}
7473
//println!("worker {} exiting", i);
7574
}));
@@ -83,9 +82,9 @@ fn run(args: &[String]) {
8382
}
8483

8584
//println!("sending stop message");
86-
to_child.send(request::stop);
85+
to_child.send(request::stop).unwrap();
8786
move_out(to_child);
88-
result = Some(from_child.recv());
87+
result = Some(from_child.recv().unwrap());
8988
});
9089
let result = result.unwrap();
9190
print!("Count is {}\n", result);

src/test/bench/msgsend-pipes.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
//
1515
// I *think* it's the same, more or less.
1616

17-
use std::comm::{channel, Sender, Receiver};
17+
use std::sync::mpsc::{channel, Sender, Receiver};
1818
use std::os;
19-
use std::str::from_str;
2019
use std::thread::Thread;
2120
use std::time::Duration;
2221
use std::uint;
@@ -33,7 +32,7 @@ fn server(requests: &Receiver<request>, responses: &Sender<uint>) {
3332
let mut count: uint = 0;
3433
let mut done = false;
3534
while !done {
36-
match requests.recv_opt() {
35+
match requests.recv() {
3736
Ok(request::get_count) => { responses.send(count.clone()); }
3837
Ok(request::bytes(b)) => {
3938
//println!("server: received {} bytes", b);
@@ -50,8 +49,8 @@ fn server(requests: &Receiver<request>, responses: &Sender<uint>) {
5049
fn run(args: &[String]) {
5150
let (to_parent, from_child) = channel();
5251

53-
let size = from_str::<uint>(args[1].as_slice()).unwrap();
54-
let workers = from_str::<uint>(args[2].as_slice()).unwrap();
52+
let size = args[1].parse::<uint>().unwrap();
53+
let workers = args[2].parse::<uint>().unwrap();
5554
let num_bytes = 100;
5655
let mut result = None;
5756
let mut to_parent = Some(to_parent);
@@ -93,7 +92,7 @@ fn run(args: &[String]) {
9392
//println!("sending stop message");
9493
//to_child.send(stop);
9594
//move_out(to_child);
96-
result = Some(from_child.recv());
95+
result = Some(from_child.recv().unwrap());
9796
});
9897
let result = result.unwrap();
9998
print!("Count is {}\n", result);

src/test/bench/rt-messaging-ping-pong.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// option. This file may not be copied, modified, or distributed
1818
// except according to those terms.
1919

20-
use std::comm::channel;
20+
use std::sync::mpsc::channel;
2121
use std::os;
2222
use std::str::from_str;
2323
use std::thread::Thread;

src/test/bench/rt-parfib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::comm::channel;
11+
use std::sync::mpsc::channel;
1212
use std::os;
13-
use std::str::from_str;
1413
use std::thread::Thread;
1514
use std::uint;
1615

@@ -28,15 +27,15 @@ fn parfib(n: uint) -> uint {
2827
tx.send(parfib(n-1));
2928
}).detach();
3029
let m2 = parfib(n-2);
31-
return (rx.recv() + m2);
30+
return (rx.recv().unwrap() + m2);
3231
}
3332

3433
fn main() {
3534

3635
let args = os::args();
3736
let args = args.as_slice();
3837
let n = if args.len() == 2 {
39-
from_str::<uint>(args[1].as_slice()).unwrap()
38+
args[1].parse::<uint>().unwrap()
4039
} else {
4140
10
4241
};

src/test/bench/shootout-binarytrees.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fn main() {
7575
} else if args.len() <= 1u {
7676
8
7777
} else {
78-
from_str(args[1].as_slice()).unwrap()
78+
args[1].parse().unwrap()
7979
};
8080
let min_depth = 4;
8181
let max_depth = if min_depth + 2 > n {min_depth + 2} else {n};

0 commit comments

Comments
 (0)