From: Alex Crichton Date: Sat, 14 Jun 2014 18:03:34 +0000 (-0700) Subject: Register new snapshots X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=89b0e6e12ba2fb24ec0e6655a1130c16eb8d1745;p=rust.git Register new snapshots --- diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index 9322985a922..61c71b273cb 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -2518,8 +2518,8 @@ valid types: trait Foo {} trait Bar {} -fn sendable_foo(f: Box) { /* ... */ } -fn shareable_bar(b: &Bar: Share) { /* ... */ } +fn sendable_foo(f: Box) { /* ... */ } +fn shareable_bar(b: &Bar + Share) { /* ... */ } ~~~ When no colon is specified (such as the type `~Foo`), it is inferred that the diff --git a/src/libcollections/bitv.rs b/src/libcollections/bitv.rs index c0b3dec086b..fb5864745d0 100644 --- a/src/libcollections/bitv.rs +++ b/src/libcollections/bitv.rs @@ -842,20 +842,6 @@ fn ne(&self, other: &BitvSet) -> bool { !self.eq(other) } } impl fmt::Show for BitvSet { - #[cfg(stage0)] - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - try!(write!(fmt, r"\{")); - let mut first = true; - for n in self.iter() { - if !first { - try!(write!(fmt, ", ")); - } - try!(write!(fmt, "{}", n)); - first = false; - } - write!(fmt, r"\}") - } - #[cfg(not(stage0))] fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { try!(write!(fmt, "{{")); let mut first = true; diff --git a/src/libcollections/smallintmap.rs b/src/libcollections/smallintmap.rs index 06c1516f1e0..4ae30348c3a 100644 --- a/src/libcollections/smallintmap.rs +++ b/src/libcollections/smallintmap.rs @@ -185,18 +185,6 @@ pub fn update(&mut self, key: uint, newval: V, ff: |V, V| -> V) -> bool { } impl fmt::Show for SmallIntMap { - #[cfg(stage0)] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - try!(write!(f, r"\{")); - - for (i, (k, v)) in self.iter().enumerate() { - if i != 0 { try!(write!(f, ", ")); } - try!(write!(f, "{}: {}", k, *v)); - } - - write!(f, r"\}") - } - #[cfg(not(stage0))] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(write!(f, "{{")); diff --git a/src/libcollections/treemap.rs b/src/libcollections/treemap.rs index 086b073a9c4..02246c33317 100644 --- a/src/libcollections/treemap.rs +++ b/src/libcollections/treemap.rs @@ -76,18 +76,6 @@ fn lt(&self, other: &TreeMap) -> bool { lt(self, other) } } impl Show for TreeMap { - #[cfg(stage0)] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - try!(write!(f, r"\{")); - - for (i, (k, v)) in self.iter().enumerate() { - if i != 0 { try!(write!(f, ", ")); } - try!(write!(f, "{}: {}", *k, *v)); - } - - write!(f, r"\}") - } - #[cfg(not(stage0))] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(write!(f, "{{")); @@ -586,18 +574,6 @@ fn lt(&self, other: &TreeSet) -> bool { self.map < other.map } } impl Show for TreeSet { - #[cfg(stage0)] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - try!(write!(f, r"\{")); - - for (i, x) in self.iter().enumerate() { - if i != 0 { try!(write!(f, ", ")); } - try!(write!(f, "{}", *x)); - } - - write!(f, r"\}") - } - #[cfg(not(stage0))] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(write!(f, "{{")); diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 053dbbe5da9..d778f3b47a1 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -744,11 +744,6 @@ fn fmt(&self, f: &mut Formatter) -> Result { } impl Show for Cell { - #[cfg(stage0)] - fn fmt(&self, f: &mut Formatter) -> Result { - write!(f, r"Cell \{ value: {} \}", self.get()) - } - #[cfg(not(stage0))] fn fmt(&self, f: &mut Formatter) -> Result { write!(f, "Cell {{ value: {} }}", self.get()) } diff --git a/src/libcore/fmt/rt.rs b/src/libcore/fmt/rt.rs index 6d3edeabca9..388084b9ed8 100644 --- a/src/libcore/fmt/rt.rs +++ b/src/libcore/fmt/rt.rs @@ -15,9 +15,6 @@ //! these can be statically allocated and are slightly optimized for the runtime -#[cfg(stage0)] -use option::Option; - #[doc(hidden)] pub enum Piece<'a> { String(&'a str), @@ -28,8 +25,6 @@ pub enum Piece<'a> { pub struct Argument<'a> { pub position: Position, pub format: FormatSpec, - #[cfg(stage0)] - pub method: Option, } #[doc(hidden)] diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 33f2a49d6d5..dc43f96b559 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -100,10 +100,6 @@ pub trait TyVisitor { fn visit_char(&mut self) -> bool; - #[cfg(stage0)] - fn visit_estr_box(&mut self) -> bool; - #[cfg(stage0)] - fn visit_estr_uniq(&mut self) -> bool; fn visit_estr_slice(&mut self) -> bool; fn visit_estr_fixed(&mut self, n: uint, sz: uint, align: uint) -> bool; @@ -112,10 +108,6 @@ pub trait TyVisitor { fn visit_ptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool; fn visit_rptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool; - #[cfg(stage0)] - fn visit_evec_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool; - #[cfg(stage0)] - fn visit_evec_uniq(&mut self, mtbl: uint, inner: *TyDesc) -> bool; fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool; fn visit_evec_fixed(&mut self, n: uint, sz: uint, align: uint, mtbl: uint, inner: *TyDesc) -> bool; diff --git a/src/libdebug/reflect.rs b/src/libdebug/reflect.rs index cd94829f354..f281161113f 100644 --- a/src/libdebug/reflect.rs +++ b/src/libdebug/reflect.rs @@ -193,16 +193,6 @@ fn visit_char(&mut self) -> bool { true } - #[cfg(stage0)] - fn visit_estr_box(&mut self) -> bool { - true - } - - #[cfg(stage0)] - fn visit_estr_uniq(&mut self) -> bool { - false - } - fn visit_estr_slice(&mut self) -> bool { self.align_to::<&'static str>(); if ! self.inner.visit_estr_slice() { return false; } @@ -247,16 +237,6 @@ fn visit_rptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool { true } - #[cfg(stage0)] - fn visit_evec_box(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { - true - } - - #[cfg(stage0)] - fn visit_evec_uniq(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { - false - } - fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool { self.align_to::<&'static [u8]>(); if ! self.inner.visit_evec_slice(mtbl, inner) { return false; } diff --git a/src/libdebug/repr.rs b/src/libdebug/repr.rs index d6ae23c6d9a..d27b0f0de7e 100644 --- a/src/libdebug/repr.rs +++ b/src/libdebug/repr.rs @@ -269,16 +269,6 @@ fn visit_char(&mut self) -> bool { }) } - #[cfg(stage0)] - fn visit_estr_box(&mut self) -> bool { - false - } - - #[cfg(stage0)] - fn visit_estr_uniq(&mut self) -> bool { - false - } - fn visit_estr_slice(&mut self) -> bool { self.get::<&str>(|this, s| this.write_escaped_slice(*s)) } @@ -320,16 +310,6 @@ fn visit_rptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool { }) } - #[cfg(stage0)] - fn visit_evec_box(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { - true - } - - #[cfg(stage0)] - fn visit_evec_uniq(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { - true - } - fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool { self.get::>(|this, s| { try!(this, this.writer.write(['&' as u8])); diff --git a/src/libgreen/basic.rs b/src/libgreen/basic.rs index 7f033a1bc61..2381626b7c8 100644 --- a/src/libgreen/basic.rs +++ b/src/libgreen/basic.rs @@ -23,16 +23,16 @@ use std::rt::exclusive::Exclusive; /// This is the only exported function from this module. -pub fn event_loop() -> Box { - box BasicLoop::new() as Box +pub fn event_loop() -> Box { + box BasicLoop::new() as Box } struct BasicLoop { - work: Vec, // pending work - remotes: Vec<(uint, Box)>, + work: Vec, // pending work + remotes: Vec<(uint, Box)>, next_remote: uint, messages: Arc>>, - idle: Option>, + idle: Option>, idle_active: Option>, } @@ -132,22 +132,22 @@ fn callback(&mut self, f: proc():Send) { } // FIXME: Seems like a really weird requirement to have an event loop provide. - fn pausable_idle_callback(&mut self, cb: Box) - -> Box { + fn pausable_idle_callback(&mut self, cb: Box) + -> Box { rtassert!(self.idle.is_none()); self.idle = Some(cb); let a = Arc::new(atomics::AtomicBool::new(true)); self.idle_active = Some(a.clone()); - box BasicPausable { active: a } as Box + box BasicPausable { active: a } as Box } - fn remote_callback(&mut self, f: Box) - -> Box { + fn remote_callback(&mut self, f: Box) + -> Box { let id = self.next_remote; self.next_remote += 1; self.remotes.push((id, f)); box BasicRemote::new(self.messages.clone(), id) as - Box + Box } fn io<'a>(&'a mut self) -> Option<&'a mut IoFactory> { None } diff --git a/src/libgreen/lib.rs b/src/libgreen/lib.rs index e8de2b9bd93..6c3ad8a6ef9 100644 --- a/src/libgreen/lib.rs +++ b/src/libgreen/lib.rs @@ -288,7 +288,7 @@ fn start(argc: int, argv: **u8) -> int { /// The return value is used as the process return code. 0 on success, 101 on /// error. pub fn start(argc: int, argv: **u8, - event_loop_factory: fn() -> Box, + event_loop_factory: fn() -> Box, main: proc():Send) -> int { rt::init(argc, argv); let mut main = Some(main); @@ -309,7 +309,7 @@ pub fn start(argc: int, argv: **u8, /// /// This function will not return until all schedulers in the associated pool /// have returned. -pub fn run(event_loop_factory: fn() -> Box, +pub fn run(event_loop_factory: fn() -> Box, main: proc():Send) -> int { // Create a scheduler pool and spawn the main task into this pool. We will // get notified over a channel when the main task exits. @@ -340,7 +340,7 @@ pub struct PoolConfig { pub threads: uint, /// A factory function used to create new event loops. If this is not /// specified then the default event loop factory is used. - pub event_loop_factory: fn() -> Box, + pub event_loop_factory: fn() -> Box, } impl PoolConfig { @@ -365,7 +365,7 @@ pub struct SchedPool { stack_pool: StackPool, deque_pool: deque::BufferPool>, sleepers: SleeperList, - factory: fn() -> Box, + factory: fn() -> Box, task_state: TaskState, tasks_done: Receiver<()>, } diff --git a/src/libgreen/sched.rs b/src/libgreen/sched.rs index 1e8f774ea16..75af52ac680 100644 --- a/src/libgreen/sched.rs +++ b/src/libgreen/sched.rs @@ -83,7 +83,7 @@ pub struct Scheduler { /// A fast XorShift rng for scheduler use rng: XorShiftRng, /// A toggleable idle callback - idle_callback: Option>, + idle_callback: Option>, /// A countdown that starts at a random value and is decremented /// every time a yield check is performed. When it hits 0 a task /// will yield. @@ -100,7 +100,7 @@ pub struct Scheduler { // destroyed before it's actually destroyed. /// The event loop used to drive the scheduler and perform I/O - pub event_loop: Box, + pub event_loop: Box, } /// An indication of how hard to work on a given operation, the difference @@ -123,7 +123,7 @@ impl Scheduler { // * Initialization Functions pub fn new(pool_id: uint, - event_loop: Box, + event_loop: Box, work_queue: deque::Worker>, work_queues: Vec>>, sleeper_list: SleeperList, @@ -136,7 +136,7 @@ pub fn new(pool_id: uint, } pub fn new_special(pool_id: uint, - event_loop: Box, + event_loop: Box, work_queue: deque::Worker>, work_queues: Vec>>, sleeper_list: SleeperList, @@ -183,7 +183,7 @@ pub fn new_special(pool_id: uint, pub fn bootstrap(mut ~self) { // Build an Idle callback. - let cb = box SchedRunner as Box; + let cb = box SchedRunner as Box; self.idle_callback = Some(self.event_loop.pausable_idle_callback(cb)); // Create a task for the scheduler with an empty context. @@ -231,7 +231,7 @@ pub fn run(mut ~self, stask: Box) -> Box { // mutable reference to the event_loop to give it the "run" // command. unsafe { - let event_loop: *mut Box = &mut self.event_loop; + let event_loop: *mut Box = &mut self.event_loop; // Our scheduler must be in the task before the event loop // is started. stask.put_with_sched(self); @@ -904,7 +904,7 @@ pub enum SchedMessage { } pub struct SchedHandle { - remote: Box, + remote: Box, queue: msgq::Producer, pub sched_id: uint } diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index 2ecfef35308..90a186f59d2 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -155,7 +155,7 @@ fn main() { /// Error log level pub static ERROR: u32 = 1; -local_data_key!(local_logger: Box) +local_data_key!(local_logger: Box) /// A trait used to represent an interface to a task-local logger. Each task /// can have its own custom logger which can respond to logging messages @@ -226,7 +226,7 @@ pub fn log(level: u32, loc: &'static LogLocation, args: &fmt::Arguments) { // frob the slot while we're doing the logging. This will destroy any logger // set during logging. let mut logger = local_logger.replace(None).unwrap_or_else(|| { - box DefaultLogger { handle: io::stderr() } as Box + box DefaultLogger { handle: io::stderr() } as Box }); logger.log(&LogRecord { level: LogLevel(level), @@ -246,7 +246,7 @@ pub fn log_level() -> u32 { unsafe { LOG_LEVEL } } /// Replaces the task-local logger with the specified logger, returning the old /// logger. -pub fn set_logger(logger: Box) -> Option> { +pub fn set_logger(logger: Box) -> Option> { local_logger.replace(Some(logger)) } diff --git a/src/libnative/io/file_unix.rs b/src/libnative/io/file_unix.rs index fda9b7b1932..f0ab77f6e40 100644 --- a/src/libnative/io/file_unix.rs +++ b/src/libnative/io/file_unix.rs @@ -167,8 +167,8 @@ fn read(&mut self, buf: &mut [u8]) -> IoResult { fn write(&mut self, buf: &[u8]) -> IoResult<()> { self.inner_write(buf) } - fn clone(&self) -> Box { - box FileDesc { inner: self.inner.clone() } as Box + fn clone(&self) -> Box { + box FileDesc { inner: self.inner.clone() } as Box } // Only supported on named pipes currently. Note that this doesn't have an diff --git a/src/libnative/io/file_win32.rs b/src/libnative/io/file_win32.rs index 5ace8e347c6..41ef5e31a91 100644 --- a/src/libnative/io/file_win32.rs +++ b/src/libnative/io/file_win32.rs @@ -201,8 +201,8 @@ fn read(&mut self, buf: &mut [u8]) -> IoResult { fn write(&mut self, buf: &[u8]) -> IoResult<()> { self.inner_write(buf) } - fn clone(&self) -> Box { - box FileDesc { inner: self.inner.clone() } as Box + fn clone(&self) -> Box { + box FileDesc { inner: self.inner.clone() } as Box } // Only supported on named pipes currently. Note that this doesn't have an diff --git a/src/libnative/io/mod.rs b/src/libnative/io/mod.rs index 4158db7bb8e..bf52c980d3a 100644 --- a/src/libnative/io/mod.rs +++ b/src/libnative/io/mod.rs @@ -166,34 +166,34 @@ impl rtio::IoFactory for IoFactory { // networking fn tcp_connect(&mut self, addr: rtio::SocketAddr, timeout: Option) - -> IoResult> + -> IoResult> { net::TcpStream::connect(addr, timeout).map(|s| { - box s as Box + box s as Box }) } fn tcp_bind(&mut self, addr: rtio::SocketAddr) - -> IoResult> { + -> IoResult> { net::TcpListener::bind(addr).map(|s| { - box s as Box + box s as Box }) } fn udp_bind(&mut self, addr: rtio::SocketAddr) - -> IoResult> { + -> IoResult> { net::UdpSocket::bind(addr).map(|u| { - box u as Box + box u as Box }) } fn unix_bind(&mut self, path: &CString) - -> IoResult> { + -> IoResult> { pipe::UnixListener::bind(path).map(|s| { - box s as Box + box s as Box }) } fn unix_connect(&mut self, path: &CString, - timeout: Option) -> IoResult> { + timeout: Option) -> IoResult> { pipe::UnixStream::connect(path, timeout).map(|s| { - box s as Box + box s as Box }) } fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>, @@ -205,18 +205,18 @@ fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>, // filesystem operations fn fs_from_raw_fd(&mut self, fd: c_int, close: rtio::CloseBehavior) - -> Box { + -> Box { let close = match close { rtio::CloseSynchronously | rtio::CloseAsynchronously => true, rtio::DontClose => false }; - box file::FileDesc::new(fd, close) as Box + box file::FileDesc::new(fd, close) as Box } fn fs_open(&mut self, path: &CString, fm: rtio::FileMode, fa: rtio::FileAccess) - -> IoResult> + -> IoResult> { - file::open(path, fm, fa).map(|fd| box fd as Box) + file::open(path, fm, fa).map(|fd| box fd as Box) } fn fs_unlink(&mut self, path: &CString) -> IoResult<()> { file::unlink(path) @@ -260,31 +260,31 @@ fn fs_utime(&mut self, src: &CString, atime: u64, } // misc - fn timer_init(&mut self) -> IoResult> { - timer::Timer::new().map(|t| box t as Box) + fn timer_init(&mut self) -> IoResult> { + timer::Timer::new().map(|t| box t as Box) } fn spawn(&mut self, cfg: rtio::ProcessConfig) - -> IoResult<(Box, - Vec>>)> { + -> IoResult<(Box, + Vec>>)> { process::Process::spawn(cfg).map(|(p, io)| { - (box p as Box, + (box p as Box, io.move_iter().map(|p| p.map(|p| { - box p as Box + box p as Box })).collect()) }) } fn kill(&mut self, pid: libc::pid_t, signum: int) -> IoResult<()> { process::Process::kill(pid, signum) } - fn pipe_open(&mut self, fd: c_int) -> IoResult> { - Ok(box file::FileDesc::new(fd, true) as Box) + fn pipe_open(&mut self, fd: c_int) -> IoResult> { + Ok(box file::FileDesc::new(fd, true) as Box) } fn tty_open(&mut self, fd: c_int, _readable: bool) - -> IoResult> { + -> IoResult> { #[cfg(unix)] use ERROR = libc::ENOTTY; #[cfg(windows)] use ERROR = libc::ERROR_INVALID_HANDLE; if unsafe { libc::isatty(fd) } != 0 { - Ok(box file::FileDesc::new(fd, true) as Box) + Ok(box file::FileDesc::new(fd, true) as Box) } else { Err(IoError { code: ERROR as uint, @@ -294,7 +294,7 @@ fn tty_open(&mut self, fd: c_int, _readable: bool) } } fn signal(&mut self, _signal: int, _cb: Box) - -> IoResult> { + -> IoResult> { Err(unimpl()) } } diff --git a/src/libnative/io/net.rs b/src/libnative/io/net.rs index 1c33114dc71..e0872d4eb76 100644 --- a/src/libnative/io/net.rs +++ b/src/libnative/io/net.rs @@ -396,12 +396,12 @@ fn letdie(&mut self) -> IoResult<()> { self.set_keepalive(None) } - fn clone(&self) -> Box { + fn clone(&self) -> Box { box TcpStream { inner: self.inner.clone(), read_deadline: 0, write_deadline: 0, - } as Box + } as Box } fn close_write(&mut self) -> IoResult<()> { @@ -483,9 +483,9 @@ pub fn native_listen(self, backlog: int) -> IoResult { } impl rtio::RtioTcpListener for TcpListener { - fn listen(~self) -> IoResult> { + fn listen(~self) -> IoResult> { self.native_listen(128).map(|a| { - box a as Box + box a as Box }) } } @@ -532,8 +532,8 @@ fn socket_name(&mut self) -> IoResult { } impl rtio::RtioTcpAcceptor for TcpAcceptor { - fn accept(&mut self) -> IoResult> { - self.native_accept().map(|s| box s as Box) + fn accept(&mut self) -> IoResult> { + self.native_accept().map(|s| box s as Box) } fn accept_simultaneously(&mut self) -> IoResult<()> { Ok(()) } @@ -719,12 +719,12 @@ fn ignore_broadcasts(&mut self) -> IoResult<()> { self.set_broadcast(false) } - fn clone(&self) -> Box { + fn clone(&self) -> Box { box UdpSocket { inner: self.inner.clone(), read_deadline: 0, write_deadline: 0, - } as Box + } as Box } fn set_timeout(&mut self, timeout: Option) { diff --git a/src/libnative/io/pipe_unix.rs b/src/libnative/io/pipe_unix.rs index 1458b475ae9..db0d1743c72 100644 --- a/src/libnative/io/pipe_unix.rs +++ b/src/libnative/io/pipe_unix.rs @@ -179,8 +179,8 @@ fn write(&mut self, buf: &[u8]) -> IoResult<()> { } } - fn clone(&self) -> Box { - box UnixStream::new(self.inner.clone()) as Box + fn clone(&self) -> Box { + box UnixStream::new(self.inner.clone()) as Box } fn close_write(&mut self) -> IoResult<()> { @@ -229,9 +229,9 @@ pub fn native_listen(self, backlog: int) -> IoResult { } impl rtio::RtioUnixListener for UnixListener { - fn listen(~self) -> IoResult> { + fn listen(~self) -> IoResult> { self.native_listen(128).map(|a| { - box a as Box + box a as Box }) } } @@ -264,8 +264,8 @@ pub fn native_accept(&mut self) -> IoResult { } impl rtio::RtioUnixAcceptor for UnixAcceptor { - fn accept(&mut self) -> IoResult> { - self.native_accept().map(|s| box s as Box) + fn accept(&mut self) -> IoResult> { + self.native_accept().map(|s| box s as Box) } fn set_timeout(&mut self, timeout: Option) { self.deadline = timeout.map(|a| ::io::timer::now() + a).unwrap_or(0); diff --git a/src/libnative/io/pipe_win32.rs b/src/libnative/io/pipe_win32.rs index b097bde2ad8..5d9ddb1f59c 100644 --- a/src/libnative/io/pipe_win32.rs +++ b/src/libnative/io/pipe_win32.rs @@ -496,14 +496,14 @@ fn write(&mut self, buf: &[u8]) -> IoResult<()> { Ok(()) } - fn clone(&self) -> Box { + fn clone(&self) -> Box { box UnixStream { inner: self.inner.clone(), read: None, write: None, read_deadline: 0, write_deadline: 0, - } as Box + } as Box } fn close_read(&mut self) -> IoResult<()> { @@ -588,9 +588,9 @@ fn drop(&mut self) { } impl rtio::RtioUnixListener for UnixListener { - fn listen(~self) -> IoResult> { + fn listen(~self) -> IoResult> { self.native_listen().map(|a| { - box a as Box + box a as Box }) } } @@ -702,8 +702,8 @@ pub fn native_accept(&mut self) -> IoResult { } impl rtio::RtioUnixAcceptor for UnixAcceptor { - fn accept(&mut self) -> IoResult> { - self.native_accept().map(|s| box s as Box) + fn accept(&mut self) -> IoResult> { + self.native_accept().map(|s| box s as Box) } fn set_timeout(&mut self, timeout: Option) { self.deadline = timeout.map(|i| i + ::io::timer::now()).unwrap_or(0); diff --git a/src/libnative/io/timer_unix.rs b/src/libnative/io/timer_unix.rs index 11f9c4b3d8c..ab993997c85 100644 --- a/src/libnative/io/timer_unix.rs +++ b/src/libnative/io/timer_unix.rs @@ -67,7 +67,7 @@ pub struct Timer { } struct Inner { - cb: Option>, + cb: Option>, interval: u64, repeat: bool, target: u64, @@ -251,7 +251,7 @@ fn sleep(&mut self, msecs: u64) { Timer::sleep(msecs); } - fn oneshot(&mut self, msecs: u64, cb: Box) { + fn oneshot(&mut self, msecs: u64, cb: Box) { let now = now(); let mut inner = self.inner(); @@ -263,7 +263,7 @@ fn oneshot(&mut self, msecs: u64, cb: Box) { unsafe { HELPER.send(NewTimer(inner)); } } - fn period(&mut self, msecs: u64, cb: Box) { + fn period(&mut self, msecs: u64, cb: Box) { let now = now(); let mut inner = self.inner(); diff --git a/src/libnative/io/timer_win32.rs b/src/libnative/io/timer_win32.rs index d175060dd98..9be09c6de07 100644 --- a/src/libnative/io/timer_win32.rs +++ b/src/libnative/io/timer_win32.rs @@ -36,7 +36,7 @@ pub struct Timer { } pub enum Req { - NewTimer(libc::HANDLE, Box, bool), + NewTimer(libc::HANDLE, Box, bool), RemoveTimer(libc::HANDLE, Sender<()>), } @@ -148,7 +148,7 @@ fn sleep(&mut self, msecs: u64) { let _ = unsafe { imp::WaitForSingleObject(self.obj, libc::INFINITE) }; } - fn oneshot(&mut self, msecs: u64, cb: Box) { + fn oneshot(&mut self, msecs: u64, cb: Box) { self.remove(); // see above for the calculation @@ -162,7 +162,7 @@ fn oneshot(&mut self, msecs: u64, cb: Box) { self.on_worker = true; } - fn period(&mut self, msecs: u64, cb: Box) { + fn period(&mut self, msecs: u64, cb: Box) { self.remove(); // see above for the calculation diff --git a/src/libregex/parse/mod.rs b/src/libregex/parse/mod.rs index cedc40df300..2fea75746be 100644 --- a/src/libregex/parse/mod.rs +++ b/src/libregex/parse/mod.rs @@ -635,11 +635,6 @@ fn parse_unicode_name(&mut self) -> Result { let closer = match self.pos('}') { Some(i) => i, - #[cfg(stage0)] - None => return self.err(format!( - "Missing '\\}' for unclosed '\\{' at position {}", - self.chari).as_slice()), - #[cfg(not(stage0))] None => return self.err(format!( "Missing '}}' for unclosed '{{' at position {}", self.chari).as_slice()), @@ -701,13 +696,6 @@ fn parse_hex(&mut self) -> Result { let start = self.chari + 2; let closer = match self.pos('}') { - #[cfg(stage0)] - None => { - return self.err(format!("Missing '\\}' for unclosed \ - '\\{' at position {}", - start).as_slice()) - } - #[cfg(not(stage0))] None => { return self.err(format!("Missing '}}' for unclosed \ '{{' at position {}", diff --git a/src/librustc/front/feature_gate.rs b/src/librustc/front/feature_gate.rs index 1204a2d97b2..30d0c6d0564 100644 --- a/src/librustc/front/feature_gate.rs +++ b/src/librustc/front/feature_gate.rs @@ -108,16 +108,6 @@ struct Context<'a> { } impl<'a> Context<'a> { - #[cfg(stage0)] - fn gate_feature(&self, feature: &str, span: Span, explain: &str) { - if !self.has_feature(feature) { - self.sess.span_err(span, explain); - self.sess.span_note(span, format!("add \\#![feature({})] to the \ - crate attributes to enable", - feature).as_slice()); - } - } - #[cfg(not(stage0))] fn gate_feature(&self, feature: &str, span: Span, explain: &str) { if !self.has_feature(feature) { self.sess.span_err(span, explain); diff --git a/src/librustc/front/std_inject.rs b/src/librustc/front/std_inject.rs index bdb884cc822..401d3fd9b24 100644 --- a/src/librustc/front/std_inject.rs +++ b/src/librustc/front/std_inject.rs @@ -63,14 +63,6 @@ struct StandardLibraryInjector<'a> { pub fn with_version(krate: &str) -> Option<(InternedString, ast::StrStyle)> { match option_env!("CFG_DISABLE_INJECT_STD_VERSION") { Some("1") => None, - #[cfg(stage0)] - _ => { - Some((token::intern_and_get_ident(format!("{}\\#{}", - krate, - VERSION).as_slice()), - ast::CookedStr)) - } - #[cfg(not(stage0))] _ => { Some((token::intern_and_get_ident(format!("{}#{}", krate, diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index 9e0bea75186..a9cec9c1842 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -161,15 +161,6 @@ pub fn report_load_errs(&mut self) { } match self.root { &None => {} - #[cfg(stage0)] - &Some(ref r) => { - for (i, path) in r.paths().iter().enumerate() { - self.sess.fileline_note(self.span, - format!("crate `{}` path \\#{}: {}", - r.ident, i+1, path.display()).as_slice()); - } - } - #[cfg(not(stage0))] &Some(ref r) => { for (i, path) in r.paths().iter().enumerate() { self.sess.fileline_note(self.span, @@ -396,7 +387,7 @@ fn extract_one(&mut self, m: HashSet, flavor: &str, flavor, self.crate_id.name).as_slice()); self.sess.span_note(self.span, - format!(r"candidate \#1: {}", + format!(r"candidate #1: {}", ret.get_ref() .display()).as_slice()); error = 1; @@ -405,7 +396,7 @@ fn extract_one(&mut self, m: HashSet, flavor: &str, if error > 0 { error += 1; self.sess.span_note(self.span, - format!(r"candidate \#{}: {}", error, + format!(r"candidate #{}: {}", error, lib.display()).as_slice()); continue } diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index b8987a382da..830178ee880 100644 --- a/src/librustc/metadata/tyencode.rs +++ b/src/librustc/metadata/tyencode.rs @@ -48,31 +48,6 @@ pub struct ty_abbrev { pub type abbrev_map = RefCell>; -#[cfg(stage0)] -pub fn enc_ty(w: &mut MemWriter, cx: &ctxt, t: ty::t) { - match cx.abbrevs.borrow_mut().find(&t) { - Some(a) => { w.write(a.s.as_bytes()); return; } - None => {} - } - let pos = w.tell().unwrap(); - enc_sty(w, cx, &ty::get(t).sty); - let end = w.tell().unwrap(); - let len = end - pos; - fn estimate_sz(u: u64) -> u64 { - let mut n = u; - let mut len = 0; - while n != 0 { len += 1; n = n >> 4; } - return len; - } - let abbrev_len = 3 + estimate_sz(pos) + estimate_sz(len); - if abbrev_len < len { - // I.e. it's actually an abbreviation. - cx.abbrevs.borrow_mut().insert(t, ty_abbrev { - s: format!("\\#{:x}:{:x}\\#", pos, len) - }); - } -} -#[cfg(not(stage0))] pub fn enc_ty(w: &mut MemWriter, cx: &ctxt, t: ty::t) { match cx.abbrevs.borrow_mut().find(&t) { Some(a) => { w.write(a.s.as_bytes()); return; } diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index b3b690c804d..392821a6ad3 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -484,12 +484,6 @@ pub fn emit_lint(level: Level, src: LintSource, msg: &str, span: Span, let mut note = None; let msg = match src { - #[cfg(stage0)] - Default => { - format!("{}, \\#[{}({})] on by default", msg, - level_to_str(level), lint_str) - }, - #[cfg(not(stage0))] Default => { format!("{}, #[{}({})] on by default", msg, level_to_str(level), lint_str) diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 57c10e19e66..f2a29d14a0d 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -1253,15 +1253,6 @@ pub fn freely_aliasable(&self, ctxt: &ty::ctxt) -> Option { } impl Repr for cmt_ { - #[cfg(stage0)] - fn repr(&self, tcx: &ty::ctxt) -> String { - format!("\\{{} id:{} m:{:?} ty:{}\\}", - self.cat.repr(tcx), - self.id, - self.mutbl, - self.ty.repr(tcx)) - } - #[cfg(not(stage0))] fn repr(&self, tcx: &ty::ctxt) -> String { format!("{{{} id:{} m:{:?} ty:{}}}", self.cat.repr(tcx), @@ -1315,9 +1306,6 @@ fn repr(&self, _tcx: &ty::ctxt) -> String { InteriorField(NamedField(fld)) => { token::get_name(fld).get().to_str() } - #[cfg(stage0)] - InteriorField(PositionalField(i)) => format!("\\#{:?}", i), - #[cfg(not(stage0))] InteriorField(PositionalField(i)) => format!("#{:?}", i), InteriorElement(_) => "[]".to_string(), } diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 112ecd66f4c..40a6713fe0c 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -642,10 +642,6 @@ fn check_field(&mut self, let msg = match name { NamedField(name) => format!("field `{}` of {} is private", token::get_ident(name), struct_desc), - #[cfg(stage0)] - UnnamedField(idx) => format!("field \\#{} of {} is private", - idx + 1, struct_desc), - #[cfg(not(stage0))] UnnamedField(idx) => format!("field #{} of {} is private", idx + 1, struct_desc), }; diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 795c292b981..23ff1ff394a 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -4070,16 +4070,6 @@ fn check_consistent_bindings(&mut self, arm: &Arm) { for (&key, &binding_0) in map_0.iter() { match map_i.find(&key) { - #[cfg(stage0)] - None => { - self.resolve_error( - p.span, - format!("variable `{}` from pattern \\#1 is \ - not bound in pattern \\#{}", - token::get_name(key), - i + 1).as_slice()); - } - #[cfg(not(stage0))] None => { self.resolve_error( p.span, @@ -4088,18 +4078,6 @@ fn check_consistent_bindings(&mut self, arm: &Arm) { token::get_name(key), i + 1).as_slice()); } - #[cfg(stage0)] - Some(binding_i) => { - if binding_0.binding_mode != binding_i.binding_mode { - self.resolve_error( - binding_i.span, - format!("variable `{}` is bound with different \ - mode in pattern \\#{} than in pattern \\#1", - token::get_name(key), - i + 1).as_slice()); - } - } - #[cfg(not(stage0))] Some(binding_i) => { if binding_0.binding_mode != binding_i.binding_mode { self.resolve_error( @@ -5107,22 +5085,6 @@ fn resolve_expr(&mut self, expr: &Expr) { // structs, which wouldn't result in this error.) match self.with_no_errors(|this| this.resolve_path(expr.id, path, TypeNS, false)) { - #[cfg(stage0)] - Some((DefTy(struct_id), _)) - if self.structs.contains_key(&struct_id) => { - self.resolve_error(expr.span, - format!("`{}` is a structure name, but \ - this expression \ - uses it like a function name", - wrong_name).as_slice()); - - self.session.span_note(expr.span, - format!("Did you mean to write: \ - `{} \\{ /* fields */ \\}`?", - wrong_name).as_slice()); - - } - #[cfg(not(stage0))] Some((DefTy(struct_id), _)) if self.structs.contains_key(&struct_id) => { self.resolve_error(expr.span, diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs index 6005d4fbda8..65bf0b85008 100644 --- a/src/librustc/middle/trans/tvec.rs +++ b/src/librustc/middle/trans/tvec.rs @@ -73,16 +73,6 @@ pub struct VecTypes { } impl VecTypes { - #[cfg(stage0)] - pub fn to_str(&self, ccx: &CrateContext) -> String { - format!("VecTypes \\{unit_ty={}, llunit_ty={}, \ - llunit_size={}, llunit_alloc_size={}\\}", - ty_to_str(ccx.tcx(), self.unit_ty), - ccx.tn.type_to_str(self.llunit_ty), - ccx.tn.val_to_str(self.llunit_size), - self.llunit_alloc_size) - } - #[cfg(not(stage0))] pub fn to_str(&self, ccx: &CrateContext) -> String { format!("VecTypes {{unit_ty={}, llunit_ty={}, \ llunit_size={}, llunit_alloc_size={}}}", diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 443eec07cc2..3ac1027221b 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -899,11 +899,6 @@ impl Vid for TyVid { } impl fmt::Show for TyVid { - #[cfg(stage0)] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result{ - write!(f, "", self.to_uint()) - } - #[cfg(not(stage0))] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result{ write!(f, "", self.to_uint()) } @@ -914,11 +909,6 @@ impl Vid for IntVid { } impl fmt::Show for IntVid { - #[cfg(stage0)] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "", self.to_uint()) - } - #[cfg(not(stage0))] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "", self.to_uint()) } @@ -929,11 +919,6 @@ impl Vid for FloatVid { } impl fmt::Show for FloatVid { - #[cfg(stage0)] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "", self.to_uint()) - } - #[cfg(not(stage0))] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "", self.to_uint()) } diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index aa687758403..864de344db2 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -1412,40 +1412,6 @@ fn report_candidate(&self, idx: uint, origin: &MethodOrigin) { } } - #[cfg(stage0)] - fn report_static_candidate(&self, idx: uint, did: DefId) { - let span = if did.krate == ast::LOCAL_CRATE { - self.tcx().map.span(did.node) - } else { - self.span - }; - self.tcx().sess.span_note( - span, - format!("candidate \\#{} is `{}`", - idx + 1u, - ty::item_path_str(self.tcx(), did)).as_slice()); - } - - #[cfg(stage0)] - fn report_param_candidate(&self, idx: uint, did: DefId) { - self.tcx().sess.span_note( - self.span, - format!("candidate \\#{} derives from the bound `{}`", - idx + 1u, - ty::item_path_str(self.tcx(), did)).as_slice()); - } - - #[cfg(stage0)] - fn report_trait_candidate(&self, idx: uint, did: DefId) { - self.tcx().sess.span_note( - self.span, - format!("candidate \\#{} derives from the type of the receiver, \ - which is the trait `{}`", - idx + 1u, - ty::item_path_str(self.tcx(), did)).as_slice()); - } - - #[cfg(not(stage0))] fn report_static_candidate(&self, idx: uint, did: DefId) { let span = if did.krate == ast::LOCAL_CRATE { self.tcx().map.span(did.node) @@ -1459,7 +1425,6 @@ fn report_static_candidate(&self, idx: uint, did: DefId) { ty::item_path_str(self.tcx(), did)).as_slice()); } - #[cfg(not(stage0))] fn report_param_candidate(&self, idx: uint, did: DefId) { self.tcx().sess.span_note( self.span, @@ -1468,7 +1433,6 @@ fn report_param_candidate(&self, idx: uint, did: DefId) { ty::item_path_str(self.tcx(), did)).as_slice()); } - #[cfg(not(stage0))] fn report_trait_candidate(&self, idx: uint, did: DefId) { self.tcx().sess.span_note( self.span, diff --git a/src/librustc/middle/typeck/infer/to_str.rs b/src/librustc/middle/typeck/infer/to_str.rs index 5be1b7ba791..097c5dcfeda 100644 --- a/src/librustc/middle/typeck/infer/to_str.rs +++ b/src/librustc/middle/typeck/infer/to_str.rs @@ -61,11 +61,6 @@ fn inf_str(&self, cx: &InferCtxt) -> String { } impl InferStr for Bounds { - #[cfg(stage0)] - fn inf_str(&self, cx: &InferCtxt) -> String { - format!("\\{{} <: {}\\}", self.lb.inf_str(cx), self.ub.inf_str(cx)) - } - #[cfg(not(stage0))] fn inf_str(&self, cx: &InferCtxt) -> String { format!("{{{} <: {}}}", self.lb.inf_str(cx), self.ub.inf_str(cx)) } diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 80f3508d0cd..aac0b12e46f 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -96,11 +96,6 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region) ReFree(ref fr) => { let prefix = match fr.bound_region { - #[cfg(stage0)] - BrAnon(idx) => { - format!("the anonymous lifetime \\#{} defined on", idx + 1) - } - #[cfg(not(stage0))] BrAnon(idx) => { format!("the anonymous lifetime #{} defined on", idx + 1) } @@ -381,9 +376,6 @@ fn push_sig_to_str(cx: &ctxt, Some(def) => token::get_ident(def.ident).get().to_string(), // This can only happen when a type mismatch error happens and // the actual type has more type parameters than the expected one. - #[cfg(stage0)] - None => format!("", id), - #[cfg(not(stage0))] None => format!("", id), }; if !cx.sess.verbose() { @@ -758,13 +750,6 @@ fn repr(&self, tcx: &ctxt) -> String { } impl Repr for ty::ty_param_bounds_and_ty { - #[cfg(stage0)] - fn repr(&self, tcx: &ctxt) -> String { - format!("ty_param_bounds_and_ty \\{generics: {}, ty: {}\\}", - self.generics.repr(tcx), - self.ty.repr(tcx)) - } - #[cfg(not(stage0))] fn repr(&self, tcx: &ctxt) -> String { format!("ty_param_bounds_and_ty {{generics: {}, ty: {}}}", self.generics.repr(tcx), @@ -836,14 +821,6 @@ fn repr(&self, _tcx: &ctxt) -> String { } impl Repr for ty::BareFnTy { - #[cfg(stage0)] - fn repr(&self, tcx: &ctxt) -> String { - format!("BareFnTy \\{fn_style: {:?}, abi: {}, sig: {}\\}", - self.fn_style, - self.abi.to_str(), - self.sig.repr(tcx)) - } - #[cfg(not(stage0))] fn repr(&self, tcx: &ctxt) -> String { format!("BareFnTy {{fn_style: {:?}, abi: {}, sig: {}}}", self.fn_style, @@ -859,14 +836,6 @@ fn repr(&self, tcx: &ctxt) -> String { } impl Repr for typeck::MethodCallee { - #[cfg(stage0)] - fn repr(&self, tcx: &ctxt) -> String { - format!("MethodCallee \\{origin: {}, ty: {}, {}\\}", - self.origin.repr(tcx), - self.ty.repr(tcx), - self.substs.repr(tcx)) - } - #[cfg(not(stage0))] fn repr(&self, tcx: &ctxt) -> String { format!("MethodCallee {{origin: {}, ty: {}, {}}}", self.origin.repr(tcx), diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index a71f702caca..29d1be88824 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -91,7 +91,6 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { impl fmt::Show for clean::Lifetime { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - try!(f.write("'".as_bytes())); try!(f.write(self.get_ref().as_bytes())); Ok(()) } diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 3c9358b03a9..f0d7b029deb 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -126,7 +126,7 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader, // span when we see the ']'. t::POUND => { is_attribute = true; - try!(write!(out, r"\#")); + try!(write!(out, r"#")); continue } t::RBRACKET => { diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index dffb2118b93..f48a93574e7 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -86,7 +86,7 @@ pub fn render(
Move up in search results
Move down in search results
-
&\#9166;
+
Go to active search result
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 0cacf2f824f..ceb7bbbc23e 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -259,8 +259,8 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result { }; // Render the HTML - let text = format!(r#"{sec}{}"#, + let text = format!(r##"{sec}{}"##, s, lvl = level, id = id, sec = if sec.len() == 0 { sec.to_string() diff --git a/src/librustdoc/html/toc.rs b/src/librustdoc/html/toc.rs index c6d8632082e..45c75ccd1ab 100644 --- a/src/librustdoc/html/toc.rs +++ b/src/librustdoc/html/toc.rs @@ -179,7 +179,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { // recursively format this table of contents (the // `{children}` is the key). try!(write!(fmt, - "\n
  • {num} {name}{children}
  • ", + "\n
  • {num} {name}{children}
  • ", id = entry.id, num = entry.sec_number, name = entry.name, children = entry.children)) diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 411521fa0db..907d9fc7561 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -136,7 +136,7 @@ fn runtest(test: &str, cratename: &str, libs: HashSet, should_fail: bool, let old = io::stdio::set_stderr(box w1); spawn(proc() { let mut p = io::ChanReader::new(rx); - let mut err = old.unwrap_or(box io::stderr() as Box); + let mut err = old.unwrap_or(box io::stderr() as Box); io::util::copy(&mut p, &mut err).unwrap(); }); let emitter = diagnostic::EmitterWriter::new(box w2); diff --git a/src/librustrt/local_data.rs b/src/librustrt/local_data.rs index 215c0992bc0..2e7c3ef37b9 100644 --- a/src/librustrt/local_data.rs +++ b/src/librustrt/local_data.rs @@ -91,7 +91,7 @@ impl LocalData for T {} // a proper map. #[doc(hidden)] pub type Map = Vec>; -type TLSValue = Box; +type TLSValue = Box; // Gets the map from the runtime. Lazily initialises if not done so already. unsafe fn get_local_map() -> Option<&mut Map> { @@ -175,7 +175,7 @@ pub fn replace(&'static self, data: Option) -> Option { // anything. let newval = data.map(|d| { let d = box d as Box; - let d: Box = unsafe { mem::transmute(d) }; + let d: Box = unsafe { mem::transmute(d) }; (keyval, d, 0) }); @@ -236,7 +236,7 @@ pub fn get(&'static self) -> Option> { // pointer part of the trait, (as ~T), and then use // compiler coercions to achieve a '&' pointer. let ptr = unsafe { - let data = data as *Box as *raw::TraitObject; + let data = data as *Box as *raw::TraitObject; &mut *((*data).data as *mut T) }; Ref { _ptr: ptr, _index: pos, _nosend: marker::NoSend, _key: self } diff --git a/src/librustrt/rtio.rs b/src/librustrt/rtio.rs index 00f761bae21..a68d453b77d 100644 --- a/src/librustrt/rtio.rs +++ b/src/librustrt/rtio.rs @@ -25,11 +25,11 @@ pub trait EventLoop { fn run(&mut self); - fn callback(&mut self, arg: proc():Send); - fn pausable_idle_callback(&mut self, Box) - -> Box; - fn remote_callback(&mut self, Box) - -> Box; + fn callback(&mut self, arg: proc(): Send); + fn pausable_idle_callback(&mut self, Box) + -> Box; + fn remote_callback(&mut self, Box) + -> Box; /// The asynchronous I/O services. Not all event loops may provide one. fn io<'a>(&'a mut self) -> Option<&'a mut IoFactory>; @@ -189,24 +189,24 @@ pub fn get<'a>(&'a mut self) -> &'a mut IoFactory { pub trait IoFactory { // networking fn tcp_connect(&mut self, addr: SocketAddr, - timeout: Option) -> IoResult>; + timeout: Option) -> IoResult>; fn tcp_bind(&mut self, addr: SocketAddr) - -> IoResult>; + -> IoResult>; fn udp_bind(&mut self, addr: SocketAddr) - -> IoResult>; + -> IoResult>; fn unix_bind(&mut self, path: &CString) - -> IoResult>; + -> IoResult>; fn unix_connect(&mut self, path: &CString, - timeout: Option) -> IoResult>; + timeout: Option) -> IoResult>; fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>, hint: Option) -> IoResult>; // filesystem operations fn fs_from_raw_fd(&mut self, fd: c_int, close: CloseBehavior) - -> Box; + -> Box; fn fs_open(&mut self, path: &CString, fm: FileMode, fa: FileAccess) - -> IoResult>; + -> IoResult>; fn fs_unlink(&mut self, path: &CString) -> IoResult<()>; fn fs_stat(&mut self, path: &CString) -> IoResult; fn fs_mkdir(&mut self, path: &CString, mode: uint) -> IoResult<()>; @@ -225,24 +225,24 @@ fn fs_utime(&mut self, src: &CString, atime: u64, mtime: u64) -> IoResult<()>; // misc - fn timer_init(&mut self) -> IoResult>; + fn timer_init(&mut self) -> IoResult>; fn spawn(&mut self, cfg: ProcessConfig) - -> IoResult<(Box, - Vec>>)>; + -> IoResult<(Box, + Vec>>)>; fn kill(&mut self, pid: libc::pid_t, signal: int) -> IoResult<()>; - fn pipe_open(&mut self, fd: c_int) -> IoResult>; + fn pipe_open(&mut self, fd: c_int) -> IoResult>; fn tty_open(&mut self, fd: c_int, readable: bool) - -> IoResult>; - fn signal(&mut self, signal: int, cb: Box) - -> IoResult>; + -> IoResult>; + fn signal(&mut self, signal: int, cb: Box) + -> IoResult>; } pub trait RtioTcpListener : RtioSocket { - fn listen(~self) -> IoResult>; + fn listen(~self) -> IoResult>; } pub trait RtioTcpAcceptor : RtioSocket { - fn accept(&mut self) -> IoResult>; + fn accept(&mut self) -> IoResult>; fn accept_simultaneously(&mut self) -> IoResult<()>; fn dont_accept_simultaneously(&mut self) -> IoResult<()>; fn set_timeout(&mut self, timeout: Option); @@ -256,7 +256,7 @@ pub trait RtioTcpStream : RtioSocket { fn nodelay(&mut self) -> IoResult<()>; fn keepalive(&mut self, delay_in_seconds: uint) -> IoResult<()>; fn letdie(&mut self) -> IoResult<()>; - fn clone(&self) -> Box; + fn clone(&self) -> Box; fn close_write(&mut self) -> IoResult<()>; fn close_read(&mut self) -> IoResult<()>; fn set_timeout(&mut self, timeout_ms: Option); @@ -284,7 +284,7 @@ pub trait RtioUdpSocket : RtioSocket { fn hear_broadcasts(&mut self) -> IoResult<()>; fn ignore_broadcasts(&mut self) -> IoResult<()>; - fn clone(&self) -> Box; + fn clone(&self) -> Box; fn set_timeout(&mut self, timeout_ms: Option); fn set_read_timeout(&mut self, timeout_ms: Option); fn set_write_timeout(&mut self, timeout_ms: Option); @@ -292,8 +292,8 @@ pub trait RtioUdpSocket : RtioSocket { pub trait RtioTimer { fn sleep(&mut self, msecs: u64); - fn oneshot(&mut self, msecs: u64, cb: Box); - fn period(&mut self, msecs: u64, cb: Box); + fn oneshot(&mut self, msecs: u64, cb: Box); + fn period(&mut self, msecs: u64, cb: Box); } pub trait RtioFileStream { @@ -319,7 +319,7 @@ pub trait RtioProcess { pub trait RtioPipe { fn read(&mut self, buf: &mut [u8]) -> IoResult; fn write(&mut self, buf: &[u8]) -> IoResult<()>; - fn clone(&self) -> Box; + fn clone(&self) -> Box; fn close_write(&mut self) -> IoResult<()>; fn close_read(&mut self) -> IoResult<()>; @@ -329,11 +329,11 @@ pub trait RtioPipe { } pub trait RtioUnixListener { - fn listen(~self) -> IoResult>; + fn listen(~self) -> IoResult>; } pub trait RtioUnixAcceptor { - fn accept(&mut self) -> IoResult>; + fn accept(&mut self) -> IoResult>; fn set_timeout(&mut self, timeout: Option); } diff --git a/src/librustrt/task.rs b/src/librustrt/task.rs index e99703a1f58..ce43f7858b6 100644 --- a/src/librustrt/task.rs +++ b/src/librustrt/task.rs @@ -46,12 +46,12 @@ pub struct Task { pub destroyed: bool, pub name: Option, - imp: Option>, + imp: Option>, } pub struct TaskOpts { /// Invoke this procedure with the result of the task when it finishes. - pub on_exit: Option, + pub on_exit: Option, /// A name for the task-to-be, for identification in failure messages pub name: Option, /// The size of the stack for the spawned task @@ -64,7 +64,7 @@ pub struct TaskOpts { /// /// If you wish for this result's delivery to block until all /// children tasks complete, recommend using a result future. -pub type Result = ::core::result::Result<(), Box>; +pub type Result = ::core::result::Result<(), Box>; pub struct GarbageCollector; pub struct LocalStorage(pub Option); @@ -79,7 +79,7 @@ pub enum BlockedTask { /// Per-task state related to task death, killing, failure, etc. pub struct Death { - pub on_exit: Option, + pub on_exit: Option, } pub struct BlockedTasks { @@ -177,7 +177,7 @@ pub fn run(~self, mut f: ||) -> Box { /// Inserts a runtime object into this task, transferring ownership to the /// task. It is illegal to replace a previous runtime object in this task /// with this argument. - pub fn put_runtime(&mut self, ops: Box) { + pub fn put_runtime(&mut self, ops: Box) { assert!(self.imp.is_none()); self.imp = Some(ops); } @@ -207,7 +207,7 @@ pub fn maybe_take_runtime(&mut self) -> Option> { Ok(t) => Some(t), Err(t) => { let data = mem::transmute::<_, raw::TraitObject>(t).data; - let obj: Box = + let obj: Box = mem::transmute(raw::TraitObject { vtable: vtable, data: data, @@ -221,7 +221,7 @@ pub fn maybe_take_runtime(&mut self) -> Option> { /// Spawns a sibling to this task. The newly spawned task is configured with /// the `opts` structure and will run `f` as the body of its code. - pub fn spawn_sibling(mut ~self, opts: TaskOpts, f: proc():Send) { + pub fn spawn_sibling(mut ~self, opts: TaskOpts, f: proc(): Send) { let ops = self.imp.take_unwrap(); ops.spawn_sibling(self, opts, f) } diff --git a/src/librustrt/unwind.rs b/src/librustrt/unwind.rs index aebed5a8829..86e2c3f3db9 100644 --- a/src/librustrt/unwind.rs +++ b/src/librustrt/unwind.rs @@ -78,15 +78,15 @@ pub struct Unwinder { unwinding: bool, - cause: Option> + cause: Option> } struct Exception { uwe: uw::_Unwind_Exception, - cause: Option>, + cause: Option>, } -pub type Callback = fn(msg: &Any:Send, file: &'static str, line: uint); +pub type Callback = fn(msg: &Any + Send, file: &'static str, line: uint); // Variables used for invoking callbacks when a task starts to unwind. // @@ -148,7 +148,7 @@ pub fn result(&mut self) -> Result { /// guaranteed that a rust task is in place when invoking this function. /// Unwinding twice can lead to resource leaks where some destructors are not /// run. -pub unsafe fn try(f: ||) -> ::core::result::Result<(), Box> { +pub unsafe fn try(f: ||) -> ::core::result::Result<(), Box> { let closure: Closure = mem::transmute(f); let ep = rust_try(try_fn, closure.code as *c_void, closure.env as *c_void); @@ -187,7 +187,7 @@ fn rust_try(f: extern "C" fn(*c_void, *c_void), // An uninlined, unmangled function upon which to slap yer breakpoints #[inline(never)] #[no_mangle] -fn rust_fail(cause: Box) -> ! { +fn rust_fail(cause: Box) -> ! { rtdebug!("begin_unwind()"); unsafe { @@ -400,7 +400,7 @@ pub fn begin_unwind(msg: M, file: &'static str, line: uint) -> ! /// Do this split took the LLVM IR line counts of `fn main() { fail!() /// }` from ~1900/3700 (-O/no opts) to 180/590. #[inline(never)] #[cold] // this is the slow path, please never inline this -fn begin_unwind_inner(msg: Box, +fn begin_unwind_inner(msg: Box, file: &'static str, line: uint) -> ! { // First, invoke call the user-defined callbacks triggered on task failure. diff --git a/src/librustuv/async.rs b/src/librustuv/async.rs index 5167ce5aff2..323bd0fbce2 100644 --- a/src/librustuv/async.rs +++ b/src/librustuv/async.rs @@ -27,12 +27,12 @@ pub struct AsyncWatcher { } struct Payload { - callback: Box, + callback: Box, exit_flag: Arc>, } impl AsyncWatcher { - pub fn new(loop_: &mut Loop, cb: Box) -> AsyncWatcher { + pub fn new(loop_: &mut Loop, cb: Box) -> AsyncWatcher { let handle = UvHandle::alloc(None::, uvll::UV_ASYNC); assert_eq!(unsafe { uvll::uv_async_init(loop_.handle, handle, async_cb) diff --git a/src/librustuv/idle.rs b/src/librustuv/idle.rs index fe8935db2ec..43ddd2681b3 100644 --- a/src/librustuv/idle.rs +++ b/src/librustuv/idle.rs @@ -18,11 +18,11 @@ pub struct IdleWatcher { handle: *uvll::uv_idle_t, idle_flag: bool, - callback: Box, + callback: Box, } impl IdleWatcher { - pub fn new(loop_: &mut Loop, cb: Box) -> Box { + pub fn new(loop_: &mut Loop, cb: Box) -> Box { let handle = UvHandle::alloc(None::, uvll::UV_IDLE); assert_eq!(unsafe { uvll::uv_idle_init(loop_.handle, handle) @@ -127,7 +127,7 @@ fn call(&mut self) { fn mk(v: uint) -> (Box, Chan) { let rc = Rc::new(RefCell::new((None, 0))); let cb = box MyCallback(rc.clone(), v); - let cb = cb as Box; + let cb = cb as Box; let cb = unsafe { mem::transmute(cb) }; (IdleWatcher::new(&mut local_loop().loop_, cb), rc) } diff --git a/src/librustuv/lib.rs b/src/librustuv/lib.rs index d67adfe501e..78c2c5ff630 100644 --- a/src/librustuv/lib.rs +++ b/src/librustuv/lib.rs @@ -125,8 +125,8 @@ fn start(argc: int, argv: **u8) -> int { /// // this code is running inside of a green task powered by libuv /// } /// ``` -pub fn event_loop() -> Box { - box uvio::UvEventLoop::new() as Box +pub fn event_loop() -> Box { + box uvio::UvEventLoop::new() as Box } /// A type that wraps a uv handle diff --git a/src/librustuv/net.rs b/src/librustuv/net.rs index 47b321b068b..c8fb0f496dc 100644 --- a/src/librustuv/net.rs +++ b/src/librustuv/net.rs @@ -165,8 +165,8 @@ pub struct TcpWatcher { pub struct TcpListener { home: HomeHandle, handle: *uvll::uv_pipe_t, - outgoing: Sender, IoError>>, - incoming: Receiver, IoError>>, + outgoing: Sender, IoError>>, + incoming: Receiver, IoError>>, } pub struct TcpAcceptor { @@ -274,7 +274,7 @@ fn letdie(&mut self) -> Result<(), IoError> { }) } - fn clone(&self) -> Box { + fn clone(&self) -> Box { box TcpWatcher { handle: self.handle, stream: StreamWatcher::new(self.handle), @@ -282,7 +282,7 @@ fn clone(&self) -> Box { refcount: self.refcount.clone(), read_access: self.read_access.clone(), write_access: self.write_access.clone(), - } as Box + } as Box } fn close_read(&mut self) -> Result<(), IoError> { @@ -388,7 +388,7 @@ fn socket_name(&mut self) -> Result { } impl rtio::RtioTcpListener for TcpListener { - fn listen(~self) -> Result, IoError> { + fn listen(~self) -> Result, IoError> { // create the acceptor object from ourselves let mut acceptor = box TcpAcceptor { listener: self, @@ -398,7 +398,7 @@ fn listen(~self) -> Result, IoError> { let _m = acceptor.fire_homing_missile(); // FIXME: the 128 backlog should be configurable match unsafe { uvll::uv_listen(acceptor.listener.handle, 128, listen_cb) } { - 0 => Ok(acceptor as Box), + 0 => Ok(acceptor as Box), n => Err(uv_error_to_io_error(UvError(n))), } } @@ -414,7 +414,7 @@ fn listen(~self) -> Result, IoError> { }); let client = TcpWatcher::new_home(&loop_, tcp.home().clone()); assert_eq!(unsafe { uvll::uv_accept(server, client.handle) }, 0); - Ok(box client as Box) + Ok(box client as Box) } n => Err(uv_error_to_io_error(UvError(n))) }; @@ -442,7 +442,7 @@ fn socket_name(&mut self) -> Result { } impl rtio::RtioTcpAcceptor for TcpAcceptor { - fn accept(&mut self) -> Result, IoError> { + fn accept(&mut self) -> Result, IoError> { self.timeout.accept(&self.listener.incoming) } @@ -740,7 +740,7 @@ fn ignore_broadcasts(&mut self) -> Result<(), IoError> { }) } - fn clone(&self) -> Box { + fn clone(&self) -> Box { box UdpWatcher { handle: self.handle, home: self.home.clone(), @@ -748,7 +748,7 @@ fn clone(&self) -> Box { write_access: self.write_access.clone(), read_access: self.read_access.clone(), blocked_sender: None, - } as Box + } as Box } fn set_timeout(&mut self, timeout: Option) { diff --git a/src/librustuv/pipe.rs b/src/librustuv/pipe.rs index e5c134b6b92..2ac9bfd202b 100644 --- a/src/librustuv/pipe.rs +++ b/src/librustuv/pipe.rs @@ -38,8 +38,8 @@ pub struct PipeWatcher { pub struct PipeListener { home: HomeHandle, pipe: *uvll::uv_pipe_t, - outgoing: Sender>>, - incoming: Receiver>>, + outgoing: Sender>>, + incoming: Receiver>>, } pub struct PipeAcceptor { @@ -129,7 +129,7 @@ fn write(&mut self, buf: &[u8]) -> IoResult<()> { self.stream.write(buf, guard.can_timeout).map_err(uv_error_to_io_error) } - fn clone(&self) -> Box { + fn clone(&self) -> Box { box PipeWatcher { stream: StreamWatcher::new(self.stream.handle), defused: false, @@ -137,7 +137,7 @@ fn clone(&self) -> Box { refcount: self.refcount.clone(), read_access: self.read_access.clone(), write_access: self.write_access.clone(), - } as Box + } as Box } fn close_read(&mut self) -> IoResult<()> { @@ -248,7 +248,7 @@ pub fn bind(io: &mut UvIoFactory, name: &CString) } impl rtio::RtioUnixListener for PipeListener { - fn listen(~self) -> IoResult> { + fn listen(~self) -> IoResult> { // create the acceptor object from ourselves let mut acceptor = box PipeAcceptor { listener: self, @@ -258,7 +258,7 @@ fn listen(~self) -> IoResult> { let _m = acceptor.fire_homing_missile(); // FIXME: the 128 backlog should be configurable match unsafe { uvll::uv_listen(acceptor.listener.pipe, 128, listen_cb) } { - 0 => Ok(acceptor as Box), + 0 => Ok(acceptor as Box), n => Err(uv_error_to_io_error(UvError(n))), } } @@ -283,7 +283,7 @@ fn uv_handle(&self) -> *uvll::uv_pipe_t { self.pipe } }); let client = PipeWatcher::new_home(&loop_, pipe.home().clone(), false); assert_eq!(unsafe { uvll::uv_accept(server, client.handle()) }, 0); - Ok(box client as Box) + Ok(box client as Box) } n => Err(uv_error_to_io_error(UvError(n))) }; @@ -300,7 +300,7 @@ fn drop(&mut self) { // PipeAcceptor implementation and traits impl rtio::RtioUnixAcceptor for PipeAcceptor { - fn accept(&mut self) -> IoResult> { + fn accept(&mut self) -> IoResult> { self.timeout.accept(&self.listener.incoming) } diff --git a/src/librustuv/signal.rs b/src/librustuv/signal.rs index fd0b6acb8ae..b478738ec8e 100644 --- a/src/librustuv/signal.rs +++ b/src/librustuv/signal.rs @@ -20,11 +20,11 @@ pub struct SignalWatcher { handle: *uvll::uv_signal_t, home: HomeHandle, - cb: Box, + cb: Box, } impl SignalWatcher { - pub fn new(io: &mut UvIoFactory, signum: int, cb: Box) + pub fn new(io: &mut UvIoFactory, signum: int, cb: Box) -> Result, UvError> { let s = box SignalWatcher { handle: UvHandle::alloc(None::, uvll::UV_SIGNAL), diff --git a/src/librustuv/timer.rs b/src/librustuv/timer.rs index b940774323a..34cd2e489a0 100644 --- a/src/librustuv/timer.rs +++ b/src/librustuv/timer.rs @@ -27,8 +27,8 @@ pub struct TimerWatcher { pub enum NextAction { WakeTask, - CallOnce(Box), - CallMany(Box, uint), + CallOnce(Box), + CallMany(Box, uint), } impl TimerWatcher { @@ -103,7 +103,7 @@ fn sleep(&mut self, msecs: u64) { self.stop(); } - fn oneshot(&mut self, msecs: u64, cb: Box) { + fn oneshot(&mut self, msecs: u64, cb: Box) { // similarly to the destructor, we must drop the previous action outside // of the homing missile let _prev_action = { @@ -115,7 +115,7 @@ fn oneshot(&mut self, msecs: u64, cb: Box) { }; } - fn period(&mut self, msecs: u64, cb: Box) { + fn period(&mut self, msecs: u64, cb: Box) { // similarly to the destructor, we must drop the previous action outside // of the homing missile let _prev_action = { diff --git a/src/librustuv/uvio.rs b/src/librustuv/uvio.rs index cf2a2d73d4d..8c9d29ee914 100644 --- a/src/librustuv/uvio.rs +++ b/src/librustuv/uvio.rs @@ -84,16 +84,16 @@ fn callback(&mut self, f: proc()) { IdleWatcher::onetime(&mut self.uvio.loop_, f); } - fn pausable_idle_callback(&mut self, cb: Box) - -> Box { + fn pausable_idle_callback(&mut self, cb: Box) + -> Box { IdleWatcher::new(&mut self.uvio.loop_, cb) - as Box + as Box } - fn remote_callback(&mut self, f: Box) - -> Box { + fn remote_callback(&mut self, f: Box) + -> Box { box AsyncWatcher::new(&mut self.uvio.loop_, f) as - Box + Box } fn io<'a>(&'a mut self) -> Option<&'a mut rtio::IoFactory> { @@ -141,31 +141,31 @@ impl IoFactory for UvIoFactory { // NB: This blocks the task waiting on the connection. // It would probably be better to return a future fn tcp_connect(&mut self, addr: rtio::SocketAddr, timeout: Option) - -> IoResult> { + -> IoResult> { match TcpWatcher::connect(self, addr, timeout) { - Ok(t) => Ok(box t as Box), + Ok(t) => Ok(box t as Box), Err(e) => Err(uv_error_to_io_error(e)), } } fn tcp_bind(&mut self, addr: rtio::SocketAddr) - -> IoResult> { + -> IoResult> { match TcpListener::bind(self, addr) { - Ok(t) => Ok(t as Box), + Ok(t) => Ok(t as Box), Err(e) => Err(uv_error_to_io_error(e)), } } fn udp_bind(&mut self, addr: rtio::SocketAddr) - -> IoResult> { + -> IoResult> { match UdpWatcher::bind(self, addr) { - Ok(u) => Ok(box u as Box), + Ok(u) => Ok(box u as Box), Err(e) => Err(uv_error_to_io_error(e)), } } - fn timer_init(&mut self) -> IoResult> { - Ok(TimerWatcher::new(self) as Box) + fn timer_init(&mut self) -> IoResult> { + Ok(TimerWatcher::new(self) as Box) } fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>, @@ -177,14 +177,14 @@ fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>, } fn fs_from_raw_fd(&mut self, fd: c_int, close: rtio::CloseBehavior) - -> Box { + -> Box { box FileWatcher::new(self, fd, close) as - Box + Box } fn fs_open(&mut self, path: &CString, fm: rtio::FileMode, fa: rtio::FileAccess) - -> IoResult> + -> IoResult> { let flags = match fm { rtio::Open => 0, @@ -201,7 +201,7 @@ fn fs_open(&mut self, path: &CString, fm: rtio::FileMode, }; match FsRequest::open(self, path, flags as int, mode as int) { - Ok(fs) => Ok(box fs as Box), + Ok(fs) => Ok(box fs as Box), Err(e) => Err(uv_error_to_io_error(e)) } } @@ -264,14 +264,14 @@ fn fs_utime(&mut self, path: &CString, atime: u64, mtime: u64) } fn spawn(&mut self, cfg: ProcessConfig) - -> IoResult<(Box, - Vec>>)> + -> IoResult<(Box, + Vec>>)> { match Process::spawn(self, cfg) { Ok((p, io)) => { - Ok((p as Box, + Ok((p as Box, io.move_iter().map(|i| i.map(|p| { - box p as Box + box p as Box })).collect())) } Err(e) => Err(uv_error_to_io_error(e)), @@ -283,43 +283,43 @@ fn kill(&mut self, pid: libc::pid_t, signum: int) -> IoResult<()> { } fn unix_bind(&mut self, path: &CString) - -> IoResult> { + -> IoResult> { match PipeListener::bind(self, path) { - Ok(p) => Ok(p as Box), + Ok(p) => Ok(p as Box), Err(e) => Err(uv_error_to_io_error(e)), } } fn unix_connect(&mut self, path: &CString, timeout: Option) - -> IoResult> { + -> IoResult> { match PipeWatcher::connect(self, path, timeout) { - Ok(p) => Ok(box p as Box), + Ok(p) => Ok(box p as Box), Err(e) => Err(uv_error_to_io_error(e)), } } fn tty_open(&mut self, fd: c_int, readable: bool) - -> IoResult> { + -> IoResult> { match TtyWatcher::new(self, fd, readable) { - Ok(tty) => Ok(box tty as Box), + Ok(tty) => Ok(box tty as Box), Err(e) => Err(uv_error_to_io_error(e)) } } fn pipe_open(&mut self, fd: c_int) - -> IoResult> + -> IoResult> { match PipeWatcher::open(self, fd) { - Ok(s) => Ok(box s as Box), + Ok(s) => Ok(box s as Box), Err(e) => Err(uv_error_to_io_error(e)) } } - fn signal(&mut self, signum: int, cb: Box) - -> IoResult> + fn signal(&mut self, signum: int, cb: Box) + -> IoResult> { match SignalWatcher::new(self, signum, cb) { - Ok(s) => Ok(s as Box), + Ok(s) => Ok(s as Box), Err(e) => Err(uv_error_to_io_error(e)), } } diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 8dfd4e778c2..436e969c48c 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -430,26 +430,6 @@ fn emit_enum(&mut self, _name: &str, f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult { f(self) } - #[cfg(stage0)] - fn emit_enum_variant(&mut self, - name: &str, - _id: uint, - cnt: uint, - f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult { - // enums are encoded as strings or objects - // Bunny => "Bunny" - // Kangaroo(34,"William") => {"variant": "Kangaroo", "fields": [34,"William"]} - if cnt == 0 { - write!(self.wr, "{}", escape_str(name)) - } else { - try!(write!(self.wr, "\\{\"variant\":")); - try!(write!(self.wr, "{}", escape_str(name))); - try!(write!(self.wr, ",\"fields\":[")); - try!(f(self)); - write!(self.wr, "]\\}") - } - } - #[cfg(not(stage0))] fn emit_enum_variant(&mut self, name: &str, _id: uint, @@ -493,16 +473,6 @@ fn emit_enum_struct_variant_field(&mut self, self.emit_enum_variant_arg(idx, f) } - #[cfg(stage0)] - fn emit_struct(&mut self, - _: &str, - _: uint, - f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult { - try!(write!(self.wr, r"\{")); - try!(f(self)); - write!(self.wr, r"\}") - } - #[cfg(not(stage0))] fn emit_struct(&mut self, _: &str, _: uint, @@ -563,13 +533,6 @@ fn emit_seq_elt(&mut self, idx: uint, f: |&mut Encoder<'a>| -> EncodeResult) -> f(self) } - #[cfg(stage0)] - fn emit_map(&mut self, _len: uint, f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult { - try!(write!(self.wr, r"\{")); - try!(f(self)); - write!(self.wr, r"\}") - } - #[cfg(not(stage0))] fn emit_map(&mut self, _len: uint, f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult { try!(write!(self.wr, "{{")); try!(f(self)); @@ -707,22 +670,6 @@ fn emit_enum_struct_variant_field(&mut self, } - #[cfg(stage0)] - fn emit_struct(&mut self, - _: &str, - len: uint, - f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult { - if len == 0 { - write!(self.wr, "\\{\\}") - } else { - try!(write!(self.wr, "\\{")); - self.indent += 2; - try!(f(self)); - self.indent -= 2; - write!(self.wr, "\n{}\\}", spaces(self.indent)) - } - } - #[cfg(not(stage0))] fn emit_struct(&mut self, _: &str, len: uint, @@ -808,21 +755,6 @@ fn emit_seq_elt(&mut self, f(self) } - #[cfg(stage0)] - fn emit_map(&mut self, - len: uint, - f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult { - if len == 0 { - write!(self.wr, "\\{\\}") - } else { - try!(write!(self.wr, "\\{")); - self.indent += 2; - try!(f(self)); - self.indent -= 2; - write!(self.wr, "\n{}\\}", spaces(self.indent)) - } - } - #[cfg(not(stage0))] fn emit_map(&mut self, len: uint, f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult { diff --git a/src/libstd/collections/hashmap.rs b/src/libstd/collections/hashmap.rs index f11e68c7a46..8feb0e0b7ee 100644 --- a/src/libstd/collections/hashmap.rs +++ b/src/libstd/collections/hashmap.rs @@ -1424,18 +1424,6 @@ fn eq(&self, other: &HashMap) -> bool { impl, V: Eq, S, H: Hasher> Eq for HashMap {} impl + Show, V: Show, S, H: Hasher> Show for HashMap { - #[cfg(stage0)] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - try!(write!(f, r"\{")); - - for (i, (k, v)) in self.iter().enumerate() { - if i != 0 { try!(write!(f, ", ")); } - try!(write!(f, "{}: {}", *k, *v)); - } - - write!(f, r"\}") - } - #[cfg(not(stage0))] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(write!(f, "{{")); @@ -1629,18 +1617,6 @@ pub fn union<'a>(&'a self, other: &'a HashSet) } impl + fmt::Show, S, H: Hasher> fmt::Show for HashSet { - #[cfg(stage0)] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - try!(write!(f, r"\{")); - - for (i, x) in self.iter().enumerate() { - if i != 0 { try!(write!(f, ", ")); } - try!(write!(f, "{}", *x)); - } - - write!(f, r"\}") - } - #[cfg(not(stage0))] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(write!(f, "{{")); diff --git a/src/libstd/collections/lru_cache.rs b/src/libstd/collections/lru_cache.rs index 0075a50f389..8ec5146c7b2 100644 --- a/src/libstd/collections/lru_cache.rs +++ b/src/libstd/collections/lru_cache.rs @@ -208,26 +208,6 @@ fn attach(&mut self, node: *mut LruEntry) { impl fmt::Show for LruCache { /// Return a string that lists the key-value pairs from most-recently /// used to least-recently used. - #[cfg(stage0)] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - try!(write!(f, r"\{")); - let mut cur = self.head; - for i in range(0, self.len()) { - if i > 0 { try!(write!(f, ", ")) } - unsafe { - cur = (*cur).next; - try!(write!(f, "{}", (*cur).key)); - } - try!(write!(f, ": ")); - unsafe { - try!(write!(f, "{}", (*cur).value)); - } - } - write!(f, r"\}") - } - /// Return a string that lists the key-value pairs from most-recently - /// used to least-recently used. - #[cfg(not(stage0))] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(write!(f, "{{")); let mut cur = self.head; diff --git a/src/libstd/failure.rs b/src/libstd/failure.rs index 903f39c7b06..d1552f0bd10 100644 --- a/src/libstd/failure.rs +++ b/src/libstd/failure.rs @@ -23,7 +23,7 @@ use string::String; // Defined in this module instead of io::stdio so that the unwinding -local_data_key!(pub local_stderr: Box) +local_data_key!(pub local_stderr: Box) impl Writer for Stdio { fn write(&mut self, bytes: &[u8]) -> IoResult<()> { @@ -35,7 +35,7 @@ fn fmt_write(f: &mut F, bytes: &[u8]) { } } -pub fn on_fail(obj: &Any:Send, file: &'static str, line: uint) { +pub fn on_fail(obj: &Any + Send, file: &'static str, line: uint) { let msg = match obj.as_ref::<&'static str>() { Some(s) => *s, None => match obj.as_ref::() { diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index 10dfec0f566..20187a6dcde 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -84,7 +84,7 @@ /// configured at creation time, via the `FileAccess` parameter to /// `File::open_mode()`. pub struct File { - fd: Box, + fd: Box, path: Path, last_nread: int, } diff --git a/src/libstd/io/net/tcp.rs b/src/libstd/io/net/tcp.rs index 6c773467553..8ffb057c934 100644 --- a/src/libstd/io/net/tcp.rs +++ b/src/libstd/io/net/tcp.rs @@ -51,11 +51,11 @@ /// drop(stream); // close the connection /// ``` pub struct TcpStream { - obj: Box, + obj: Box, } impl TcpStream { - fn new(s: Box) -> TcpStream { + fn new(s: Box) -> TcpStream { TcpStream { obj: s } } @@ -326,7 +326,7 @@ fn write(&mut self, buf: &[u8]) -> IoResult<()> { /// # } /// ``` pub struct TcpListener { - obj: Box, + obj: Box, } impl TcpListener { @@ -382,7 +382,7 @@ fn listen(self) -> IoResult { /// a `TcpListener`'s `listen` method, and this object can be used to accept new /// `TcpStream` instances. pub struct TcpAcceptor { - obj: Box, + obj: Box, } impl TcpAcceptor { diff --git a/src/libstd/io/net/udp.rs b/src/libstd/io/net/udp.rs index 538bba36958..e1f9cb3889f 100644 --- a/src/libstd/io/net/udp.rs +++ b/src/libstd/io/net/udp.rs @@ -57,7 +57,7 @@ /// drop(socket); // close the socket /// ``` pub struct UdpSocket { - obj: Box, + obj: Box, } impl UdpSocket { diff --git a/src/libstd/io/net/unix.rs b/src/libstd/io/net/unix.rs index 9715a821e4f..8f4f66836ad 100644 --- a/src/libstd/io/net/unix.rs +++ b/src/libstd/io/net/unix.rs @@ -36,7 +36,7 @@ /// A stream which communicates over a named pipe. pub struct UnixStream { - obj: Box, + obj: Box, } impl UnixStream { @@ -144,7 +144,7 @@ fn write(&mut self, buf: &[u8]) -> IoResult<()> { /// A value that can listen for incoming named pipe connection requests. pub struct UnixListener { /// The internal, opaque runtime Unix listener. - obj: Box, + obj: Box, } impl UnixListener { @@ -188,7 +188,7 @@ fn listen(self) -> IoResult { /// A value that can accept named pipe connections, returned from `listen()`. pub struct UnixAcceptor { /// The internal, opaque runtime Unix acceptor. - obj: Box, + obj: Box, } impl UnixAcceptor { diff --git a/src/libstd/io/pipe.rs b/src/libstd/io/pipe.rs index 11bb27573c2..6e2009545aa 100644 --- a/src/libstd/io/pipe.rs +++ b/src/libstd/io/pipe.rs @@ -24,7 +24,7 @@ /// A synchronous, in-memory pipe. pub struct PipeStream { /// The internal, opaque runtime pipe object. - obj: Box, + obj: Box, } impl PipeStream { @@ -55,7 +55,7 @@ pub fn open(fd: libc::c_int) -> IoResult { } #[doc(hidden)] - pub fn new(inner: Box) -> PipeStream { + pub fn new(inner: Box) -> PipeStream { PipeStream { obj: inner } } } diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index a626d1f3a6c..38d8475ddf7 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -58,7 +58,7 @@ /// assert!(child.wait().unwrap().success()); /// ``` pub struct Process { - handle: Box, + handle: Box, /// Handle to the child's stdin, if the `stdin` field of this process's /// `ProcessConfig` was `CreatePipe`. By default, this handle is `Some`. diff --git a/src/libstd/io/signal.rs b/src/libstd/io/signal.rs index 598a8667d41..4a7655a63ce 100644 --- a/src/libstd/io/signal.rs +++ b/src/libstd/io/signal.rs @@ -82,7 +82,7 @@ pub enum Signum { /// ``` pub struct Listener { /// A map from signums to handles to keep the handles in memory - handles: Vec<(Signum, Box)>, + handles: Vec<(Signum, Box)>, /// This is where all the handles send signums, which are received by /// the clients from the receiver. tx: Sender, diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 84b91814c87..071480fb5ee 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -71,8 +71,8 @@ // tl;dr; TTY works on everything but when windows stdout is redirected, in that // case pipe also doesn't work, but magically file does! enum StdSource { - TTY(Box), - File(Box), + TTY(Box), + File(Box), } fn src(fd: libc::c_int, readable: bool, f: |StdSource| -> T) -> T { @@ -84,7 +84,7 @@ fn src(fd: libc::c_int, readable: bool, f: |StdSource| -> T) -> T { }).map_err(IoError::from_rtio_error).unwrap() } -local_data_key!(local_stdout: Box) +local_data_key!(local_stdout: Box) /// Creates a new non-blocking handle to the stdin of the current process. /// @@ -163,7 +163,7 @@ pub fn stderr_raw() -> StdWriter { /// /// Note that this does not need to be called for all new tasks; the default /// output handle is to the process's stdout stream. -pub fn set_stdout(stdout: Box) -> Option> { +pub fn set_stdout(stdout: Box) -> Option> { local_stdout.replace(Some(stdout)).and_then(|mut s| { let _ = s.flush(); Some(s) @@ -178,7 +178,7 @@ pub fn set_stdout(stdout: Box) -> Option> { /// /// Note that this does not need to be called for all new tasks; the default /// output handle is to the process's stderr stream. -pub fn set_stderr(stderr: Box) -> Option> { +pub fn set_stderr(stderr: Box) -> Option> { local_stderr.replace(Some(stderr)).and_then(|mut s| { let _ = s.flush(); Some(s) @@ -198,7 +198,7 @@ pub fn set_stderr(stderr: Box) -> Option> { fn with_task_stdout(f: |&mut Writer| -> IoResult<()>) { let result = if Local::exists(None::) { let mut my_stdout = local_stdout.replace(None).unwrap_or_else(|| { - box stdout() as Box + box stdout() as Box }); let result = f(my_stdout); local_stdout.replace(Some(my_stdout)); diff --git a/src/libstd/io/timer.rs b/src/libstd/io/timer.rs index 1529cf8f92d..da099953a49 100644 --- a/src/libstd/io/timer.rs +++ b/src/libstd/io/timer.rs @@ -64,7 +64,7 @@ /// # } /// ``` pub struct Timer { - obj: Box, + obj: Box, } struct TimerCallback { tx: Sender<()> } diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index b9bb0054d44..553c7af18cb 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -899,12 +899,6 @@ pub fn make_non_verbatim(path: &Path) -> Option { // \\?\D:\ Path::new(repr.slice_from(4)) } - #[cfg(stage0)] - Some(VerbatimUNCPrefix(_,_)) => { - // \\?\UNC\server\share - Path::new(format!(r"\\{}", repr.slice_from(7))) - } - #[cfg(not(stage0))] Some(VerbatimUNCPrefix(_,_)) => { // \\?\UNC\server\share Path::new(format!(r"\{}", repr.slice_from(7))) diff --git a/src/libstd/task.rs b/src/libstd/task.rs index a4e1ad84252..f543188af42 100644 --- a/src/libstd/task.rs +++ b/src/libstd/task.rs @@ -63,9 +63,9 @@ pub struct TaskOpts { /// The size of the stack for the spawned task pub stack_size: Option, /// Task-local stdout - pub stdout: Option>, + pub stdout: Option>, /// Task-local stderr - pub stderr: Option>, + pub stderr: Option>, } /** @@ -83,7 +83,7 @@ pub struct TaskOpts { pub struct TaskBuilder { /// Options to spawn the new task with pub opts: TaskOpts, - gen_body: Option proc():Send>, + gen_body: Option proc(): Send>, nocopy: marker::NoCopy, } @@ -146,7 +146,7 @@ pub fn named>(mut self, name: S) -> TaskBuilder { * existing body generator to the new body generator. */ pub fn with_wrapper(mut self, - wrapper: proc(v: proc():Send):Send -> proc():Send) + wrapper: proc(v: proc(): Send): Send -> proc(): Send) -> TaskBuilder { self.gen_body = match self.gen_body.take() { @@ -163,7 +163,7 @@ pub fn with_wrapper(mut self, * the provided unique closure. The task has the properties and behavior * specified by the task_builder. */ - pub fn spawn(mut self, f: proc():Send) { + pub fn spawn(mut self, f: proc(): Send) { let gen_body = self.gen_body.take(); let f = match gen_body { Some(gen) => gen(f), @@ -204,8 +204,8 @@ pub fn spawn(mut self, f: proc():Send) { * # Failure * Fails if a future_result was already set for this task. */ - pub fn try(mut self, f: proc():Send -> T) - -> Result> { + pub fn try(mut self, f: proc(): Send -> T) + -> Result> { let (tx, rx) = channel(); let result = self.future_result(); @@ -247,7 +247,7 @@ pub fn new() -> TaskOpts { /// the provided unique closure. /// /// This function is equivalent to `TaskBuilder::new().spawn(f)`. -pub fn spawn(f: proc():Send) { +pub fn spawn(f: proc(): Send) { TaskBuilder::new().spawn(f) } @@ -255,7 +255,7 @@ pub fn spawn(f: proc():Send) { /// the function or an error if the task failed /// /// This is equivalent to TaskBuilder::new().try -pub fn try(f: proc():Send -> T) -> Result> { +pub fn try(f: proc(): Send -> T) -> Result> { TaskBuilder::new().try(f) } @@ -344,7 +344,7 @@ fn test_run_basic() { fn test_with_wrapper() { let (tx, rx) = channel(); TaskBuilder::new().with_wrapper(proc(body) { - let result: proc():Send = proc() { + let result: proc(): Send = proc() { body(); tx.send(()); }; @@ -430,7 +430,7 @@ fn test_spawn_sched_childs_on_default_sched() { } #[cfg(test)] -fn avoid_copying_the_body(spawnfn: |v: proc():Send|) { +fn avoid_copying_the_body(spawnfn: |v: proc(): Send|) { let (tx, rx) = channel::(); let x = box 1; @@ -476,7 +476,7 @@ fn test_child_doesnt_ref_parent() { // (well, it would if the constant were 8000+ - I lowered it to be more // valgrind-friendly. try this at home, instead..!) static generations: uint = 16; - fn child_no(x: uint) -> proc():Send { + fn child_no(x: uint) -> proc(): Send { return proc() { if x < generations { TaskBuilder::new().spawn(child_no(x+1)); @@ -522,10 +522,10 @@ fn test_try_fail_message_owned_str() { #[test] fn test_try_fail_message_any() { match try(proc() { - fail!(box 413u16 as Box); + fail!(box 413u16 as Box); }) { Err(e) => { - type T = Box; + type T = Box; assert!(e.is::()); let any = e.move::().unwrap(); assert!(any.is::()); diff --git a/src/libsync/raw.rs b/src/libsync/raw.rs index 5df08790c41..c5f452d3e58 100644 --- a/src/libsync/raw.rs +++ b/src/libsync/raw.rs @@ -828,7 +828,7 @@ fn test_mutex_killed_simple() { let m = Arc::new(Mutex::new()); let m2 = m.clone(); - let result: result::Result<(), Box> = task::try(proc() { + let result: result::Result<(), Box> = task::try(proc() { let _lock = m2.lock(); fail!(); }); @@ -1068,7 +1068,7 @@ fn rwlock_kill_helper(mode1: RWLockMode, mode2: RWLockMode) { let x = Arc::new(RWLock::new()); let x2 = x.clone(); - let result: result::Result<(), Box> = task::try(proc() { + let result: result::Result<(), Box> = task::try(proc() { lock_rwlock_in_mode(&x2, mode1, || { fail!(); }) diff --git a/src/libsyntax/crateid.rs b/src/libsyntax/crateid.rs index d5e0a4e80d4..8ac54a191f2 100644 --- a/src/libsyntax/crateid.rs +++ b/src/libsyntax/crateid.rs @@ -32,23 +32,6 @@ pub struct CrateId { } impl fmt::Show for CrateId { - #[cfg(stage0)] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - try!(write!(f, "{}", self.path)); - let version = match self.version { - None => "0.0", - Some(ref version) => version.as_slice(), - }; - if self.path == self.name || - self.path - .as_slice() - .ends_with(format!("/{}", self.name).as_slice()) { - write!(f, "\\#{}", version) - } else { - write!(f, "\\#{}:{}", self.name, version) - } - } - #[cfg(not(stage0))] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(write!(f, "{}", self.path)); let version = match self.version { diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index ee06efbec13..16c463f0c96 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -118,7 +118,7 @@ pub fn handler<'a>(&'a self) -> &'a Handler { // others log errors for later reporting. pub struct Handler { err_count: Cell, - emit: RefCell>, + emit: RefCell>, } impl Handler { @@ -187,7 +187,7 @@ pub fn default_handler(color_config: ColorConfig) -> Handler { mk_handler(box EmitterWriter::stderr(color_config)) } -pub fn mk_handler(e: Box) -> Handler { +pub fn mk_handler(e: Box) -> Handler { Handler { err_count: Cell::new(0), emit: RefCell::new(e), @@ -281,8 +281,8 @@ pub struct EmitterWriter { } enum Destination { - Terminal(Box>:Send>), - Raw(Box), + Terminal(Box> + Send>), + Raw(Box), } impl EmitterWriter { @@ -306,7 +306,7 @@ pub fn stderr(color_config: ColorConfig) -> EmitterWriter { } } - pub fn new(dst: Box) -> EmitterWriter { + pub fn new(dst: Box) -> EmitterWriter { EmitterWriter { dst: Raw(dst) } } } diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index 7aa93dee11d..50b1639484d 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -145,29 +145,6 @@ pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) inputs.push((constraint, input)); } } - #[cfg(stage0)] - Clobbers => { - let mut clobs = Vec::new(); - while p.token != token::EOF && - p.token != token::COLON && - p.token != token::MOD_SEP { - - if clobs.len() != 0 { - p.eat(&token::COMMA); - } - - let (s, _str_style) = p.parse_str(); - let clob = format!("~\\{{}\\}", s); - clobs.push(clob); - - if OPTIONS.iter().any(|opt| s.equiv(opt)) { - cx.span_warn(p.last_span, "expected a clobber, but found an option"); - } - } - - cons = clobs.connect(","); - } - #[cfg(not(stage0))] Clobbers => { let mut clobs = Vec::new(); while p.token != token::EOF && diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 421f8b1294d..960894e6963 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -257,13 +257,13 @@ pub enum SyntaxExtension { /// A normal, function-like syntax extension. /// /// `bytes!` is a `NormalTT`. - NormalTT(Box, Option), + NormalTT(Box, Option), /// A function-like syntax extension that has an extra ident before /// the block. /// /// `macro_rules!` is an `IdentTT`. - IdentTT(Box, Option), + IdentTT(Box, Option), } pub type NamedSyntaxExtension = (Name, SyntaxExtension); diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index f48ddf4417b..e47080dadfd 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -90,13 +90,6 @@ fn parse_attribute(&mut self, permit_inner: bool) -> ast::Attribute { let hi = self.span.hi; (mk_sp(lo, hi), meta_item, style) } - #[cfg(stage0)] - _ => { - let token_str = self.this_token_to_str(); - self.fatal(format!("expected `\\#` but found `{}`", - token_str).as_slice()); - } - #[cfg(not(stage0))] _ => { let token_str = self.this_token_to_str(); self.fatal(format!("expected `#` but found `{}`", diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ae3b8587ee5..8b50a6270bc 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -302,7 +302,7 @@ pub struct Parser<'a> { pub tokens_consumed: uint, pub restriction: restriction, pub quote_depth: uint, // not (yet) related to the quasiquoter - pub reader: Box, + pub reader: Box, pub interner: Rc, /// The set of seen errors about obsolete syntax. Used to suppress /// extra detail when the same error is seen twice @@ -325,7 +325,8 @@ fn is_plain_ident_or_underscore(t: &token::Token) -> bool { } impl<'a> Parser<'a> { - pub fn new(sess: &'a ParseSess, cfg: ast::CrateConfig, mut rdr: Box) -> Parser<'a> { + pub fn new(sess: &'a ParseSess, cfg: ast::CrateConfig, + mut rdr: Box) -> Parser<'a> { let tok0 = rdr.next_token(); let span = tok0.sp; let placeholder = TokenAndSpan { @@ -1232,13 +1233,6 @@ pub fn parse_trait_methods(&mut self) -> Vec { }) } - #[cfg(stage0)] - _ => { - let token_str = p.this_token_to_str(); - p.fatal((format!("expected `;` or `\\{` but found `{}`", - token_str)).as_slice()) - } - #[cfg(not(stage0))] _ => { let token_str = p.this_token_to_str(); p.fatal((format!("expected `;` or `{{` but found `{}`", @@ -1645,12 +1639,9 @@ pub fn parse_path(&mut self, mode: PathParsingMode) -> PathAndBounds { } // Next, parse a plus and bounded type parameters, if applicable. - // - // NOTE(stage0, pcwalton): Remove `token::COLON` after a snapshot. let bounds = if mode == LifetimeAndTypesAndBounds { let bounds = { - if self.eat(&token::BINOP(token::PLUS)) || - self.eat(&token::COLON) { + if self.eat(&token::BINOP(token::PLUS)) { let (_, bounds) = self.parse_ty_param_bounds(false); Some(bounds) } else { @@ -3208,21 +3199,6 @@ fn check_expected_item(p: &mut Parser, found_attrs: bool) { // consuming more tokens). let (bra, ket) = match token::close_delimiter_for(&self.token) { Some(ket) => (self.token.clone(), ket), - #[cfg(stage0)] - None => { - // we only expect an ident if we didn't parse one - // above. - let ident_str = if id == token::special_idents::invalid { - "identifier, " - } else { - "" - }; - let tok_str = self.this_token_to_str(); - self.fatal(format!("expected {}`(` or `\\{`, but found `{}`", - ident_str, - tok_str).as_slice()) - } - #[cfg(not(stage0))] None => { // we only expect an ident if we didn't parse one // above. @@ -4153,15 +4129,6 @@ pub fn parse_single_struct_field(&mut self, self.bump(); } token::RBRACE => {} - #[cfg(stage0)] - _ => { - let span = self.span; - let token_str = self.this_token_to_str(); - self.span_fatal(span, - format!("expected `,`, or `\\}` but found `{}`", - token_str).as_slice()) - } - #[cfg(not(stage0))] _ => { let span = self.span; let token_str = self.this_token_to_str(); diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index 33e61b97420..47250175485 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -68,25 +68,25 @@ #[cfg(not(windows))] /// Return a Terminal wrapping stdout, or None if a terminal couldn't be /// opened. -pub fn stdout() -> Option>:Send>> { - let ti: Option>> - = Terminal::new(box std::io::stdout() as Box); - ti.map(|t| box t as Box:Send>:Send>) +pub fn stdout() -> Option> + Send>> { + let ti: Option>> + = Terminal::new(box std::io::stdout() as Box); + ti.map(|t| box t as Box + Send> + Send>) } #[cfg(windows)] /// Return a Terminal wrapping stdout, or None if a terminal couldn't be /// opened. -pub fn stdout() -> Option:Send>:Send>> { - let ti: Option>> - = Terminal::new(box std::io::stdout() as Box); +pub fn stdout() -> Option + Send> + Send>> { + let ti: Option>> + = Terminal::new(box std::io::stdout() as Box); match ti { - Some(t) => Some(box t as Box:Send>:Send>), + Some(t) => Some(box t as Box + Send> + Send>), None => { - let wc: Option>> - = Terminal::new(box std::io::stdout() as Box); - wc.map(|w| box w as Box:Send>:Send>) + let wc: Option>> + = Terminal::new(box std::io::stdout() as Box); + wc.map(|w| box w as Box + Send> + Send>) } } } @@ -94,25 +94,25 @@ pub fn stdout() -> Option:Send>:Send>> { #[cfg(not(windows))] /// Return a Terminal wrapping stderr, or None if a terminal couldn't be /// opened. -pub fn stderr() -> Option:Send>:Send>:Send> { - let ti: Option>> - = Terminal::new(box std::io::stderr() as Box); - ti.map(|t| box t as Box:Send>:Send>) +pub fn stderr() -> Option + Send> + Send> + Send> { + let ti: Option>> + = Terminal::new(box std::io::stderr() as Box); + ti.map(|t| box t as Box + Send> + Send>) } #[cfg(windows)] /// Return a Terminal wrapping stderr, or None if a terminal couldn't be /// opened. -pub fn stderr() -> Option:Send>:Send>> { - let ti: Option>> - = Terminal::new(box std::io::stderr() as Box); +pub fn stderr() -> Option + Send> + Send>> { + let ti: Option>> + = Terminal::new(box std::io::stderr() as Box); match ti { - Some(t) => Some(box t as Box:Send>:Send>), + Some(t) => Some(box t as Box + Send> + Send>), None => { - let wc: Option>> - = Terminal::new(box std::io::stderr() as Box); - wc.map(|w| box w as Box:Send>:Send>) + let wc: Option>> + = Terminal::new(box std::io::stderr() as Box); + wc.map(|w| box w as Box + Send> + Send>) } } } diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 9108a2c9459..e7c35fb59ee 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -346,16 +346,16 @@ fn usage(binary: &str) { Test Attributes: - \#[test] - Indicates a function is a test to be run. This function + #[test] - Indicates a function is a test to be run. This function takes no arguments. - \#[bench] - Indicates a function is a benchmark to be run. This + #[bench] - Indicates a function is a benchmark to be run. This function takes one argument (test::Bencher). - \#[should_fail] - This function (also labeled with \#[test]) will only pass if + #[should_fail] - This function (also labeled with #[test]) will only pass if the code causes a failure (an assertion failure or fail!) - \#[ignore] - When applied to a function which is already attributed as a + #[ignore] - When applied to a function which is already attributed as a test, then the test runner will ignore these tests during normal test runs. Running with --ignored will run these - tests. This may also be written as \#[ignore(cfg(...))] to + tests. This may also be written as #[ignore(cfg(...))] to ignore the test on certain configurations.", usage = getopts::usage(message.as_slice(), optgroups().as_slice())); @@ -473,7 +473,7 @@ pub enum TestResult { } enum OutputLocation { - Pretty(Box>:Send>), + Pretty(Box> + Send>), Raw(T), } @@ -1049,8 +1049,8 @@ fn run_test_inner(desc: TestDesc, if nocapture { drop((stdout, stderr)); } else { - task.opts.stdout = Some(box stdout as Box); - task.opts.stderr = Some(box stderr as Box); + task.opts.stdout = Some(box stdout as Box); + task.opts.stderr = Some(box stderr as Box); } let result_future = task.future_result(); task.spawn(testfn); diff --git a/src/snapshots.txt b/src/snapshots.txt index e137b54e54a..d528cb16e72 100644 --- a/src/snapshots.txt +++ b/src/snapshots.txt @@ -1,3 +1,11 @@ +S 2014-06-14 2c6caad + freebsd-x86_64 0152ba43f238014f0aede7c29f1c684c21077b0b + linux-i386 2eb1897c25abe0d5978ff03171ca943e92666046 + linux-x86_64 c974465b482334461bf9771864eee3873e3cb3f9 + macos-i386 5b138c0ea9028ec56ed215ad86ec3e69e5a9ffd3 + macos-x86_64 294afb78328d63c7774f07303ef7138219ee02e7 + winnt-i386 303afde8b5ca002c151f42df727d6ae701d086cd + S 2014-06-11 f9260d4 freebsd-x86_64 57f155da12e561a277506f999a616ff689a55dcc linux-i386 df46b5dab3620375d6175c284ea0aeb3f9c6a11e diff --git a/src/test/compile-fail/issue-7013.rs b/src/test/compile-fail/issue-7013.rs index 3028db00f58..bff8ba629aa 100644 --- a/src/test/compile-fail/issue-7013.rs +++ b/src/test/compile-fail/issue-7013.rs @@ -27,7 +27,7 @@ fn set(&mut self, v: Rc>) } struct A { - v: Box, + v: Box, } fn main() { diff --git a/src/test/compile-fail/kindck-owned-trait-contains.rs b/src/test/compile-fail/kindck-owned-trait-contains.rs index 3f6c622dd0d..6921acde45e 100644 --- a/src/test/compile-fail/kindck-owned-trait-contains.rs +++ b/src/test/compile-fail/kindck-owned-trait-contains.rs @@ -15,8 +15,8 @@ impl Repeat for A { fn get(&self) -> A { self.clone() } } -fn repeater(v: A) -> Box:> { - box v as Box:> // No +fn repeater(v: A) -> Box> { + box v as Box> // No } fn main() { diff --git a/src/test/compile-fail/owned-ptr-static-bound.rs b/src/test/compile-fail/owned-ptr-static-bound.rs index 48f04c33494..dc6e8b1d6be 100644 --- a/src/test/compile-fail/owned-ptr-static-bound.rs +++ b/src/test/compile-fail/owned-ptr-static-bound.rs @@ -15,16 +15,16 @@ trait A {} trait X {} impl<'a, T> X for B<'a, T> {} -fn f<'a, T, U>(v: Box>) -> Box { - box B(v) as Box //~ ERROR value may contain references; add `'static` bound to `T` +fn f<'a, T, U>(v: Box>) -> Box { + box B(v) as Box //~ ERROR value may contain references; add `'static` bound to `T` } -fn g<'a, T, U>(v: Box>) -> Box { - box B(v) as Box //~ ERROR value may contain references; add `'static` bound to `U` +fn g<'a, T, U>(v: Box>) -> Box { + box B(v) as Box //~ ERROR value may contain references; add `'static` bound to `U` } -fn h<'a, T: 'static>(v: Box>) -> Box { - box B(v) as Box // ok +fn h<'a, T: 'static>(v: Box>) -> Box { + box B(v) as Box // ok } fn main() {} diff --git a/src/test/compile-fail/regions-bound-lists-feature-gate.rs b/src/test/compile-fail/regions-bound-lists-feature-gate.rs index aa398bcd557..de3b2faef86 100644 --- a/src/test/compile-fail/regions-bound-lists-feature-gate.rs +++ b/src/test/compile-fail/regions-bound-lists-feature-gate.rs @@ -11,7 +11,7 @@ trait Foo { } -fn foo<'a>(x: Box) { //~ ERROR only the 'static lifetime is accepted here +fn foo<'a>(x: Box) { //~ ERROR only the 'static lifetime is accepted here } fn bar<'a, T:'a>() { //~ ERROR only the 'static lifetime is accepted here diff --git a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs index 435c90c7830..f0f388a5a07 100644 --- a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs +++ b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs @@ -13,7 +13,7 @@ trait Foo { // This should emit the less confusing error, not the more confusing one. -fn foo(_x: Foo:Send) { +fn foo(_x: Foo + Send) { //~^ERROR reference to trait `Foo` where a type is expected; try `Box` or `&Foo` } diff --git a/src/test/compile-fail/trait-bounds-not-on-impl.rs b/src/test/compile-fail/trait-bounds-not-on-impl.rs index ac88b21b456..38c78144601 100644 --- a/src/test/compile-fail/trait-bounds-not-on-impl.rs +++ b/src/test/compile-fail/trait-bounds-not-on-impl.rs @@ -13,7 +13,7 @@ trait Foo { struct Bar; -impl Foo:Owned for Bar { //~ ERROR bounded traits are only valid in type position +impl Foo + Owned for Bar { //~ ERROR bounded traits are only valid in type position } fn main() { } diff --git a/src/test/compile-fail/trait-bounds-not-on-struct.rs b/src/test/compile-fail/trait-bounds-not-on-struct.rs index be5375d2938..0a5909ff2ef 100644 --- a/src/test/compile-fail/trait-bounds-not-on-struct.rs +++ b/src/test/compile-fail/trait-bounds-not-on-struct.rs @@ -11,6 +11,6 @@ struct Foo; -fn foo(_x: Box) { } //~ ERROR kind bounds can only be used on trait types +fn foo(_x: Box) { } //~ ERROR kind bounds can only be used on trait types fn main() { } diff --git a/src/test/run-pass/alignment-gep-tup-like-1.rs b/src/test/run-pass/alignment-gep-tup-like-1.rs index 4fa695de522..dec53672d87 100644 --- a/src/test/run-pass/alignment-gep-tup-like-1.rs +++ b/src/test/run-pass/alignment-gep-tup-like-1.rs @@ -29,11 +29,11 @@ fn f(&self) -> (A, u16) { } } -fn f(a: A, b: u16) -> Box:> { +fn f(a: A, b: u16) -> Box> { box Invoker { a: a, b: b, - } as (Box>+) + } as (Box>) } pub fn main() { diff --git a/src/test/run-pass/issue-2734.rs b/src/test/run-pass/issue-2734.rs index 3422b9a799d..e331173a158 100644 --- a/src/test/run-pass/issue-2734.rs +++ b/src/test/run-pass/issue-2734.rs @@ -12,8 +12,8 @@ trait hax { } impl hax for A { } -fn perform_hax(x: Box) -> Box { - box x as Box +fn perform_hax(x: Box) -> Box { + box x as Box } fn deadcode() { diff --git a/src/test/run-pass/issue-2735.rs b/src/test/run-pass/issue-2735.rs index 8a5391773bb..622b35b93ae 100644 --- a/src/test/run-pass/issue-2735.rs +++ b/src/test/run-pass/issue-2735.rs @@ -12,8 +12,8 @@ trait hax { } impl hax for A { } -fn perform_hax(x: Box) -> Box { - box x as Box +fn perform_hax(x: Box) -> Box { + box x as Box } fn deadcode() { diff --git a/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs b/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs index 7cd7e70be74..47a09d55438 100644 --- a/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs +++ b/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs @@ -20,6 +20,6 @@ pub fn main() {} trait A {} impl A for T {} -fn owned1(a: T) { box a as Box; } /* note `:` */ -fn owned2(a: Box) { a as Box; } -fn owned3(a: Box) { box a as Box; } +fn owned1(a: T) { box a as Box; } /* note `:` */ +fn owned2(a: Box) { a as Box; } +fn owned3(a: Box) { box a as Box; } diff --git a/src/test/run-pass/kindck-owned-trait-contains-1.rs b/src/test/run-pass/kindck-owned-trait-contains-1.rs index 3dae50bda33..ed8115cd6ca 100644 --- a/src/test/run-pass/kindck-owned-trait-contains-1.rs +++ b/src/test/run-pass/kindck-owned-trait-contains-1.rs @@ -17,9 +17,9 @@ fn get(&self) -> A { } } -fn repeater(v: Box) -> Box:> { +fn repeater(v: Box) -> Box> { // Note: owned kind is not necessary as A appears in the trait type - box v as Box:> // No + box v as Box> // No } pub fn main() { diff --git a/src/test/run-pass/objects-owned-object-borrowed-method-header.rs b/src/test/run-pass/objects-owned-object-borrowed-method-header.rs index be1b135ddc9..815488b8c66 100644 --- a/src/test/run-pass/objects-owned-object-borrowed-method-header.rs +++ b/src/test/run-pass/objects-owned-object-borrowed-method-header.rs @@ -31,10 +31,10 @@ fn foo(&self) -> uint { } pub fn main() { - let foos: Vec> = vec!( - box BarStruct{ x: box(GC) 0 } as Box, - box BarStruct{ x: box(GC) 1 } as Box, - box BarStruct{ x: box(GC) 2 } as Box + let foos: Vec> = vec!( + box BarStruct{ x: box(GC) 0 } as Box, + box BarStruct{ x: box(GC) 1 } as Box, + box BarStruct{ x: box(GC) 2 } as Box ); for i in range(0u, foos.len()) { diff --git a/src/test/run-pass/objects-owned-object-owned-method.rs b/src/test/run-pass/objects-owned-object-owned-method.rs index cac132b8e36..540593c43fb 100644 --- a/src/test/run-pass/objects-owned-object-owned-method.rs +++ b/src/test/run-pass/objects-owned-object-owned-method.rs @@ -28,6 +28,6 @@ fn foo(~self) -> uint { } pub fn main() { - let foo = box BarStruct{ x: 22 } as Box; + let foo = box BarStruct{ x: 22 } as Box; assert_eq!(22, foo.foo()); } diff --git a/src/test/run-pass/parameterized-trait-with-bounds.rs b/src/test/run-pass/parameterized-trait-with-bounds.rs index 6f33fb470e7..fbc28298165 100644 --- a/src/test/run-pass/parameterized-trait-with-bounds.rs +++ b/src/test/run-pass/parameterized-trait-with-bounds.rs @@ -19,10 +19,10 @@ mod foo { pub trait D<'a, T> {} } -fn foo1(_: &A: Send) {} -fn foo2(_: Box: Send + Share>) {} -fn foo3(_: Box: 'static>) {} -fn foo4<'a, T>(_: Box: 'static + Send>) {} -fn foo5<'a, T>(_: Box: 'static + Send>) {} +fn foo1(_: &A + Send) {} +fn foo2(_: Box + Send + Share>) {} +fn foo3(_: Box + 'static>) {} +fn foo4<'a, T>(_: Box + 'static + Send>) {} +fn foo5<'a, T>(_: Box + 'static + Send>) {} pub fn main() {} diff --git a/src/test/run-pass/regions-bound-lists-feature-gate.rs b/src/test/run-pass/regions-bound-lists-feature-gate.rs index 3e23c1d4d64..c5baecf7272 100644 --- a/src/test/run-pass/regions-bound-lists-feature-gate.rs +++ b/src/test/run-pass/regions-bound-lists-feature-gate.rs @@ -15,10 +15,10 @@ trait Foo { } -fn foo<'a>(x: Box) { +fn foo<'a>(x: Box) { } -fn bar<'a, T:'a>() { +fn bar<'a, T: 'a>() { } pub fn main() { }