Register new snapshots
This commit is contained in:
parent
6d8342f5e9
commit
89b0e6e12b
@ -2518,8 +2518,8 @@ valid types:
|
||||
trait Foo {}
|
||||
trait Bar<T> {}
|
||||
|
||||
fn sendable_foo(f: Box<Foo:Send>) { /* ... */ }
|
||||
fn shareable_bar<T: Share>(b: &Bar<T>: Share) { /* ... */ }
|
||||
fn sendable_foo(f: Box<Foo + Send>) { /* ... */ }
|
||||
fn shareable_bar<T: Share>(b: &Bar<T> + Share) { /* ... */ }
|
||||
~~~
|
||||
|
||||
When no colon is specified (such as the type `~Foo`), it is inferred that the
|
||||
|
@ -842,20 +842,6 @@ impl cmp::PartialEq for BitvSet {
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -185,18 +185,6 @@ impl<V:Clone> SmallIntMap<V> {
|
||||
}
|
||||
|
||||
impl<V: fmt::Show> fmt::Show for SmallIntMap<V> {
|
||||
#[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, "{{"));
|
||||
|
||||
|
@ -76,18 +76,6 @@ impl<K: PartialOrd + Ord, V: PartialOrd> PartialOrd for TreeMap<K, V> {
|
||||
}
|
||||
|
||||
impl<K: Ord + Show, V: Show> Show for TreeMap<K, V> {
|
||||
#[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 @@ impl<T: PartialOrd + Ord> PartialOrd for TreeSet<T> {
|
||||
}
|
||||
|
||||
impl<T: Ord + Show> Show for TreeSet<T> {
|
||||
#[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, "{{"));
|
||||
|
||||
|
@ -744,11 +744,6 @@ impl Show for () {
|
||||
}
|
||||
|
||||
impl<T: Copy + Show> Show for Cell<T> {
|
||||
#[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())
|
||||
}
|
||||
|
@ -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<uint>,
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
|
@ -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;
|
||||
|
@ -193,16 +193,6 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
|
||||
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 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
|
||||
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; }
|
||||
|
@ -269,16 +269,6 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
|
||||
})
|
||||
}
|
||||
|
||||
#[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 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
|
||||
})
|
||||
}
|
||||
|
||||
#[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::<raw::Slice<()>>(|this, s| {
|
||||
try!(this, this.writer.write(['&' as u8]));
|
||||
|
@ -23,16 +23,16 @@ use std::rt::rtio::{PausableIdleCallback, Callback};
|
||||
use std::rt::exclusive::Exclusive;
|
||||
|
||||
/// This is the only exported function from this module.
|
||||
pub fn event_loop() -> Box<EventLoop:Send> {
|
||||
box BasicLoop::new() as Box<EventLoop:Send>
|
||||
pub fn event_loop() -> Box<EventLoop + Send> {
|
||||
box BasicLoop::new() as Box<EventLoop + Send>
|
||||
}
|
||||
|
||||
struct BasicLoop {
|
||||
work: Vec<proc():Send>, // pending work
|
||||
remotes: Vec<(uint, Box<Callback:Send>)>,
|
||||
work: Vec<proc(): Send>, // pending work
|
||||
remotes: Vec<(uint, Box<Callback + Send>)>,
|
||||
next_remote: uint,
|
||||
messages: Arc<Exclusive<Vec<Message>>>,
|
||||
idle: Option<Box<Callback:Send>>,
|
||||
idle: Option<Box<Callback + Send>>,
|
||||
idle_active: Option<Arc<atomics::AtomicBool>>,
|
||||
}
|
||||
|
||||
@ -132,22 +132,22 @@ impl EventLoop for BasicLoop {
|
||||
}
|
||||
|
||||
// FIXME: Seems like a really weird requirement to have an event loop provide.
|
||||
fn pausable_idle_callback(&mut self, cb: Box<Callback:Send>)
|
||||
-> Box<PausableIdleCallback:Send> {
|
||||
fn pausable_idle_callback(&mut self, cb: Box<Callback + Send>)
|
||||
-> Box<PausableIdleCallback + Send> {
|
||||
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<PausableIdleCallback:Send>
|
||||
box BasicPausable { active: a } as Box<PausableIdleCallback + Send>
|
||||
}
|
||||
|
||||
fn remote_callback(&mut self, f: Box<Callback:Send>)
|
||||
-> Box<RemoteCallback:Send> {
|
||||
fn remote_callback(&mut self, f: Box<Callback + Send>)
|
||||
-> Box<RemoteCallback + Send> {
|
||||
let id = self.next_remote;
|
||||
self.next_remote += 1;
|
||||
self.remotes.push((id, f));
|
||||
box BasicRemote::new(self.messages.clone(), id) as
|
||||
Box<RemoteCallback:Send>
|
||||
Box<RemoteCallback + Send>
|
||||
}
|
||||
|
||||
fn io<'a>(&'a mut self) -> Option<&'a mut IoFactory> { None }
|
||||
|
@ -288,7 +288,7 @@ macro_rules! green_start( ($f:ident) => (
|
||||
/// 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<rtio::EventLoop:Send>,
|
||||
event_loop_factory: fn() -> Box<rtio::EventLoop + Send>,
|
||||
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<rtio::EventLoop:Send>,
|
||||
pub fn run(event_loop_factory: fn() -> Box<rtio::EventLoop + Send>,
|
||||
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<rtio::EventLoop:Send>,
|
||||
pub event_loop_factory: fn() -> Box<rtio::EventLoop + Send>,
|
||||
}
|
||||
|
||||
impl PoolConfig {
|
||||
@ -365,7 +365,7 @@ pub struct SchedPool {
|
||||
stack_pool: StackPool,
|
||||
deque_pool: deque::BufferPool<Box<task::GreenTask>>,
|
||||
sleepers: SleeperList,
|
||||
factory: fn() -> Box<rtio::EventLoop:Send>,
|
||||
factory: fn() -> Box<rtio::EventLoop + Send>,
|
||||
task_state: TaskState,
|
||||
tasks_done: Receiver<()>,
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ pub struct Scheduler {
|
||||
/// A fast XorShift rng for scheduler use
|
||||
rng: XorShiftRng,
|
||||
/// A toggleable idle callback
|
||||
idle_callback: Option<Box<PausableIdleCallback:Send>>,
|
||||
idle_callback: Option<Box<PausableIdleCallback + Send>>,
|
||||
/// 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<EventLoop:Send>,
|
||||
pub event_loop: Box<EventLoop + Send>,
|
||||
}
|
||||
|
||||
/// 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<EventLoop:Send>,
|
||||
event_loop: Box<EventLoop + Send>,
|
||||
work_queue: deque::Worker<Box<GreenTask>>,
|
||||
work_queues: Vec<deque::Stealer<Box<GreenTask>>>,
|
||||
sleeper_list: SleeperList,
|
||||
@ -136,7 +136,7 @@ impl Scheduler {
|
||||
}
|
||||
|
||||
pub fn new_special(pool_id: uint,
|
||||
event_loop: Box<EventLoop:Send>,
|
||||
event_loop: Box<EventLoop + Send>,
|
||||
work_queue: deque::Worker<Box<GreenTask>>,
|
||||
work_queues: Vec<deque::Stealer<Box<GreenTask>>>,
|
||||
sleeper_list: SleeperList,
|
||||
@ -183,7 +183,7 @@ impl Scheduler {
|
||||
pub fn bootstrap(mut ~self) {
|
||||
|
||||
// Build an Idle callback.
|
||||
let cb = box SchedRunner as Box<Callback:Send>;
|
||||
let cb = box SchedRunner as Box<Callback + Send>;
|
||||
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 @@ impl Scheduler {
|
||||
// mutable reference to the event_loop to give it the "run"
|
||||
// command.
|
||||
unsafe {
|
||||
let event_loop: *mut Box<EventLoop:Send> = &mut self.event_loop;
|
||||
let event_loop: *mut Box<EventLoop + Send> = &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<RemoteCallback:Send>,
|
||||
remote: Box<RemoteCallback + Send>,
|
||||
queue: msgq::Producer<SchedMessage>,
|
||||
pub sched_id: uint
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ pub static WARN: u32 = 2;
|
||||
/// Error log level
|
||||
pub static ERROR: u32 = 1;
|
||||
|
||||
local_data_key!(local_logger: Box<Logger:Send>)
|
||||
local_data_key!(local_logger: Box<Logger + Send>)
|
||||
|
||||
/// 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<Logger:Send>
|
||||
box DefaultLogger { handle: io::stderr() } as Box<Logger + Send>
|
||||
});
|
||||
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<Logger:Send>) -> Option<Box<Logger:Send>> {
|
||||
pub fn set_logger(logger: Box<Logger + Send>) -> Option<Box<Logger + Send>> {
|
||||
local_logger.replace(Some(logger))
|
||||
}
|
||||
|
||||
|
@ -167,8 +167,8 @@ impl rtio::RtioPipe for FileDesc {
|
||||
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
|
||||
self.inner_write(buf)
|
||||
}
|
||||
fn clone(&self) -> Box<rtio::RtioPipe:Send> {
|
||||
box FileDesc { inner: self.inner.clone() } as Box<rtio::RtioPipe:Send>
|
||||
fn clone(&self) -> Box<rtio::RtioPipe + Send> {
|
||||
box FileDesc { inner: self.inner.clone() } as Box<rtio::RtioPipe + Send>
|
||||
}
|
||||
|
||||
// Only supported on named pipes currently. Note that this doesn't have an
|
||||
|
@ -201,8 +201,8 @@ impl rtio::RtioPipe for FileDesc {
|
||||
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
|
||||
self.inner_write(buf)
|
||||
}
|
||||
fn clone(&self) -> Box<rtio::RtioPipe:Send> {
|
||||
box FileDesc { inner: self.inner.clone() } as Box<rtio::RtioPipe:Send>
|
||||
fn clone(&self) -> Box<rtio::RtioPipe + Send> {
|
||||
box FileDesc { inner: self.inner.clone() } as Box<rtio::RtioPipe + Send>
|
||||
}
|
||||
|
||||
// Only supported on named pipes currently. Note that this doesn't have an
|
||||
|
@ -166,34 +166,34 @@ impl rtio::IoFactory for IoFactory {
|
||||
// networking
|
||||
fn tcp_connect(&mut self, addr: rtio::SocketAddr,
|
||||
timeout: Option<u64>)
|
||||
-> IoResult<Box<rtio::RtioTcpStream:Send>>
|
||||
-> IoResult<Box<rtio::RtioTcpStream + Send>>
|
||||
{
|
||||
net::TcpStream::connect(addr, timeout).map(|s| {
|
||||
box s as Box<rtio::RtioTcpStream:Send>
|
||||
box s as Box<rtio::RtioTcpStream + Send>
|
||||
})
|
||||
}
|
||||
fn tcp_bind(&mut self, addr: rtio::SocketAddr)
|
||||
-> IoResult<Box<rtio::RtioTcpListener:Send>> {
|
||||
-> IoResult<Box<rtio::RtioTcpListener + Send>> {
|
||||
net::TcpListener::bind(addr).map(|s| {
|
||||
box s as Box<rtio::RtioTcpListener:Send>
|
||||
box s as Box<rtio::RtioTcpListener + Send>
|
||||
})
|
||||
}
|
||||
fn udp_bind(&mut self, addr: rtio::SocketAddr)
|
||||
-> IoResult<Box<rtio::RtioUdpSocket:Send>> {
|
||||
-> IoResult<Box<rtio::RtioUdpSocket + Send>> {
|
||||
net::UdpSocket::bind(addr).map(|u| {
|
||||
box u as Box<rtio::RtioUdpSocket:Send>
|
||||
box u as Box<rtio::RtioUdpSocket + Send>
|
||||
})
|
||||
}
|
||||
fn unix_bind(&mut self, path: &CString)
|
||||
-> IoResult<Box<rtio::RtioUnixListener:Send>> {
|
||||
-> IoResult<Box<rtio::RtioUnixListener + Send>> {
|
||||
pipe::UnixListener::bind(path).map(|s| {
|
||||
box s as Box<rtio::RtioUnixListener:Send>
|
||||
box s as Box<rtio::RtioUnixListener + Send>
|
||||
})
|
||||
}
|
||||
fn unix_connect(&mut self, path: &CString,
|
||||
timeout: Option<u64>) -> IoResult<Box<rtio::RtioPipe:Send>> {
|
||||
timeout: Option<u64>) -> IoResult<Box<rtio::RtioPipe + Send>> {
|
||||
pipe::UnixStream::connect(path, timeout).map(|s| {
|
||||
box s as Box<rtio::RtioPipe:Send>
|
||||
box s as Box<rtio::RtioPipe + Send>
|
||||
})
|
||||
}
|
||||
fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
|
||||
@ -205,18 +205,18 @@ impl rtio::IoFactory for IoFactory {
|
||||
|
||||
// filesystem operations
|
||||
fn fs_from_raw_fd(&mut self, fd: c_int, close: rtio::CloseBehavior)
|
||||
-> Box<rtio::RtioFileStream:Send> {
|
||||
-> Box<rtio::RtioFileStream + Send> {
|
||||
let close = match close {
|
||||
rtio::CloseSynchronously | rtio::CloseAsynchronously => true,
|
||||
rtio::DontClose => false
|
||||
};
|
||||
box file::FileDesc::new(fd, close) as Box<rtio::RtioFileStream:Send>
|
||||
box file::FileDesc::new(fd, close) as Box<rtio::RtioFileStream + Send>
|
||||
}
|
||||
fn fs_open(&mut self, path: &CString, fm: rtio::FileMode,
|
||||
fa: rtio::FileAccess)
|
||||
-> IoResult<Box<rtio::RtioFileStream:Send>>
|
||||
-> IoResult<Box<rtio::RtioFileStream + Send>>
|
||||
{
|
||||
file::open(path, fm, fa).map(|fd| box fd as Box<rtio::RtioFileStream:Send>)
|
||||
file::open(path, fm, fa).map(|fd| box fd as Box<rtio::RtioFileStream + Send>)
|
||||
}
|
||||
fn fs_unlink(&mut self, path: &CString) -> IoResult<()> {
|
||||
file::unlink(path)
|
||||
@ -260,31 +260,31 @@ impl rtio::IoFactory for IoFactory {
|
||||
}
|
||||
|
||||
// misc
|
||||
fn timer_init(&mut self) -> IoResult<Box<rtio::RtioTimer:Send>> {
|
||||
timer::Timer::new().map(|t| box t as Box<rtio::RtioTimer:Send>)
|
||||
fn timer_init(&mut self) -> IoResult<Box<rtio::RtioTimer + Send>> {
|
||||
timer::Timer::new().map(|t| box t as Box<rtio::RtioTimer + Send>)
|
||||
}
|
||||
fn spawn(&mut self, cfg: rtio::ProcessConfig)
|
||||
-> IoResult<(Box<rtio::RtioProcess:Send>,
|
||||
Vec<Option<Box<rtio::RtioPipe:Send>>>)> {
|
||||
-> IoResult<(Box<rtio::RtioProcess + Send>,
|
||||
Vec<Option<Box<rtio::RtioPipe + Send>>>)> {
|
||||
process::Process::spawn(cfg).map(|(p, io)| {
|
||||
(box p as Box<rtio::RtioProcess:Send>,
|
||||
(box p as Box<rtio::RtioProcess + Send>,
|
||||
io.move_iter().map(|p| p.map(|p| {
|
||||
box p as Box<rtio::RtioPipe:Send>
|
||||
box p as Box<rtio::RtioPipe + Send>
|
||||
})).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<Box<rtio::RtioPipe:Send>> {
|
||||
Ok(box file::FileDesc::new(fd, true) as Box<rtio::RtioPipe:Send>)
|
||||
fn pipe_open(&mut self, fd: c_int) -> IoResult<Box<rtio::RtioPipe + Send>> {
|
||||
Ok(box file::FileDesc::new(fd, true) as Box<rtio::RtioPipe + Send>)
|
||||
}
|
||||
fn tty_open(&mut self, fd: c_int, _readable: bool)
|
||||
-> IoResult<Box<rtio::RtioTTY:Send>> {
|
||||
-> IoResult<Box<rtio::RtioTTY + Send>> {
|
||||
#[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<rtio::RtioTTY:Send>)
|
||||
Ok(box file::FileDesc::new(fd, true) as Box<rtio::RtioTTY + Send>)
|
||||
} else {
|
||||
Err(IoError {
|
||||
code: ERROR as uint,
|
||||
@ -294,7 +294,7 @@ impl rtio::IoFactory for IoFactory {
|
||||
}
|
||||
}
|
||||
fn signal(&mut self, _signal: int, _cb: Box<rtio::Callback>)
|
||||
-> IoResult<Box<rtio::RtioSignal:Send>> {
|
||||
-> IoResult<Box<rtio::RtioSignal + Send>> {
|
||||
Err(unimpl())
|
||||
}
|
||||
}
|
||||
|
@ -396,12 +396,12 @@ impl rtio::RtioTcpStream for TcpStream {
|
||||
self.set_keepalive(None)
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<rtio::RtioTcpStream:Send> {
|
||||
fn clone(&self) -> Box<rtio::RtioTcpStream + Send> {
|
||||
box TcpStream {
|
||||
inner: self.inner.clone(),
|
||||
read_deadline: 0,
|
||||
write_deadline: 0,
|
||||
} as Box<rtio::RtioTcpStream:Send>
|
||||
} as Box<rtio::RtioTcpStream + Send>
|
||||
}
|
||||
|
||||
fn close_write(&mut self) -> IoResult<()> {
|
||||
@ -483,9 +483,9 @@ impl TcpListener {
|
||||
}
|
||||
|
||||
impl rtio::RtioTcpListener for TcpListener {
|
||||
fn listen(~self) -> IoResult<Box<rtio::RtioTcpAcceptor:Send>> {
|
||||
fn listen(~self) -> IoResult<Box<rtio::RtioTcpAcceptor + Send>> {
|
||||
self.native_listen(128).map(|a| {
|
||||
box a as Box<rtio::RtioTcpAcceptor:Send>
|
||||
box a as Box<rtio::RtioTcpAcceptor + Send>
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -532,8 +532,8 @@ impl rtio::RtioSocket for TcpAcceptor {
|
||||
}
|
||||
|
||||
impl rtio::RtioTcpAcceptor for TcpAcceptor {
|
||||
fn accept(&mut self) -> IoResult<Box<rtio::RtioTcpStream:Send>> {
|
||||
self.native_accept().map(|s| box s as Box<rtio::RtioTcpStream:Send>)
|
||||
fn accept(&mut self) -> IoResult<Box<rtio::RtioTcpStream + Send>> {
|
||||
self.native_accept().map(|s| box s as Box<rtio::RtioTcpStream + Send>)
|
||||
}
|
||||
|
||||
fn accept_simultaneously(&mut self) -> IoResult<()> { Ok(()) }
|
||||
@ -719,12 +719,12 @@ impl rtio::RtioUdpSocket for UdpSocket {
|
||||
self.set_broadcast(false)
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<rtio::RtioUdpSocket:Send> {
|
||||
fn clone(&self) -> Box<rtio::RtioUdpSocket + Send> {
|
||||
box UdpSocket {
|
||||
inner: self.inner.clone(),
|
||||
read_deadline: 0,
|
||||
write_deadline: 0,
|
||||
} as Box<rtio::RtioUdpSocket:Send>
|
||||
} as Box<rtio::RtioUdpSocket + Send>
|
||||
}
|
||||
|
||||
fn set_timeout(&mut self, timeout: Option<u64>) {
|
||||
|
@ -179,8 +179,8 @@ impl rtio::RtioPipe for UnixStream {
|
||||
}
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<rtio::RtioPipe:Send> {
|
||||
box UnixStream::new(self.inner.clone()) as Box<rtio::RtioPipe:Send>
|
||||
fn clone(&self) -> Box<rtio::RtioPipe + Send> {
|
||||
box UnixStream::new(self.inner.clone()) as Box<rtio::RtioPipe + Send>
|
||||
}
|
||||
|
||||
fn close_write(&mut self) -> IoResult<()> {
|
||||
@ -229,9 +229,9 @@ impl UnixListener {
|
||||
}
|
||||
|
||||
impl rtio::RtioUnixListener for UnixListener {
|
||||
fn listen(~self) -> IoResult<Box<rtio::RtioUnixAcceptor:Send>> {
|
||||
fn listen(~self) -> IoResult<Box<rtio::RtioUnixAcceptor + Send>> {
|
||||
self.native_listen(128).map(|a| {
|
||||
box a as Box<rtio::RtioUnixAcceptor:Send>
|
||||
box a as Box<rtio::RtioUnixAcceptor + Send>
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -264,8 +264,8 @@ impl UnixAcceptor {
|
||||
}
|
||||
|
||||
impl rtio::RtioUnixAcceptor for UnixAcceptor {
|
||||
fn accept(&mut self) -> IoResult<Box<rtio::RtioPipe:Send>> {
|
||||
self.native_accept().map(|s| box s as Box<rtio::RtioPipe:Send>)
|
||||
fn accept(&mut self) -> IoResult<Box<rtio::RtioPipe + Send>> {
|
||||
self.native_accept().map(|s| box s as Box<rtio::RtioPipe + Send>)
|
||||
}
|
||||
fn set_timeout(&mut self, timeout: Option<u64>) {
|
||||
self.deadline = timeout.map(|a| ::io::timer::now() + a).unwrap_or(0);
|
||||
|
@ -496,14 +496,14 @@ impl rtio::RtioPipe for UnixStream {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<rtio::RtioPipe:Send> {
|
||||
fn clone(&self) -> Box<rtio::RtioPipe + Send> {
|
||||
box UnixStream {
|
||||
inner: self.inner.clone(),
|
||||
read: None,
|
||||
write: None,
|
||||
read_deadline: 0,
|
||||
write_deadline: 0,
|
||||
} as Box<rtio::RtioPipe:Send>
|
||||
} as Box<rtio::RtioPipe + Send>
|
||||
}
|
||||
|
||||
fn close_read(&mut self) -> IoResult<()> {
|
||||
@ -588,9 +588,9 @@ impl Drop for UnixListener {
|
||||
}
|
||||
|
||||
impl rtio::RtioUnixListener for UnixListener {
|
||||
fn listen(~self) -> IoResult<Box<rtio::RtioUnixAcceptor:Send>> {
|
||||
fn listen(~self) -> IoResult<Box<rtio::RtioUnixAcceptor + Send>> {
|
||||
self.native_listen().map(|a| {
|
||||
box a as Box<rtio::RtioUnixAcceptor:Send>
|
||||
box a as Box<rtio::RtioUnixAcceptor + Send>
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -702,8 +702,8 @@ impl UnixAcceptor {
|
||||
}
|
||||
|
||||
impl rtio::RtioUnixAcceptor for UnixAcceptor {
|
||||
fn accept(&mut self) -> IoResult<Box<rtio::RtioPipe:Send>> {
|
||||
self.native_accept().map(|s| box s as Box<rtio::RtioPipe:Send>)
|
||||
fn accept(&mut self) -> IoResult<Box<rtio::RtioPipe + Send>> {
|
||||
self.native_accept().map(|s| box s as Box<rtio::RtioPipe + Send>)
|
||||
}
|
||||
fn set_timeout(&mut self, timeout: Option<u64>) {
|
||||
self.deadline = timeout.map(|i| i + ::io::timer::now()).unwrap_or(0);
|
||||
|
@ -67,7 +67,7 @@ pub struct Timer {
|
||||
}
|
||||
|
||||
struct Inner {
|
||||
cb: Option<Box<rtio::Callback:Send>>,
|
||||
cb: Option<Box<rtio::Callback + Send>>,
|
||||
interval: u64,
|
||||
repeat: bool,
|
||||
target: u64,
|
||||
@ -251,7 +251,7 @@ impl rtio::RtioTimer for Timer {
|
||||
Timer::sleep(msecs);
|
||||
}
|
||||
|
||||
fn oneshot(&mut self, msecs: u64, cb: Box<rtio::Callback:Send>) {
|
||||
fn oneshot(&mut self, msecs: u64, cb: Box<rtio::Callback + Send>) {
|
||||
let now = now();
|
||||
let mut inner = self.inner();
|
||||
|
||||
@ -263,7 +263,7 @@ impl rtio::RtioTimer for Timer {
|
||||
unsafe { HELPER.send(NewTimer(inner)); }
|
||||
}
|
||||
|
||||
fn period(&mut self, msecs: u64, cb: Box<rtio::Callback:Send>) {
|
||||
fn period(&mut self, msecs: u64, cb: Box<rtio::Callback + Send>) {
|
||||
let now = now();
|
||||
let mut inner = self.inner();
|
||||
|
||||
|
@ -36,7 +36,7 @@ pub struct Timer {
|
||||
}
|
||||
|
||||
pub enum Req {
|
||||
NewTimer(libc::HANDLE, Box<Callback:Send>, bool),
|
||||
NewTimer(libc::HANDLE, Box<Callback + Send>, bool),
|
||||
RemoveTimer(libc::HANDLE, Sender<()>),
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ impl rtio::RtioTimer for Timer {
|
||||
let _ = unsafe { imp::WaitForSingleObject(self.obj, libc::INFINITE) };
|
||||
}
|
||||
|
||||
fn oneshot(&mut self, msecs: u64, cb: Box<Callback:Send>) {
|
||||
fn oneshot(&mut self, msecs: u64, cb: Box<Callback + Send>) {
|
||||
self.remove();
|
||||
|
||||
// see above for the calculation
|
||||
@ -162,7 +162,7 @@ impl rtio::RtioTimer for Timer {
|
||||
self.on_worker = true;
|
||||
}
|
||||
|
||||
fn period(&mut self, msecs: u64, cb: Box<Callback:Send>) {
|
||||
fn period(&mut self, msecs: u64, cb: Box<Callback + Send>) {
|
||||
self.remove();
|
||||
|
||||
// see above for the calculation
|
||||
|
@ -635,11 +635,6 @@ impl<'a> Parser<'a> {
|
||||
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 @@ impl<'a> Parser<'a> {
|
||||
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 {}",
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -161,15 +161,6 @@ impl<'a> Context<'a> {
|
||||
}
|
||||
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 @@ impl<'a> Context<'a> {
|
||||
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 @@ impl<'a> Context<'a> {
|
||||
if error > 0 {
|
||||
error += 1;
|
||||
self.sess.span_note(self.span,
|
||||
format!(r"candidate \#{}: {}", error,
|
||||
format!(r"candidate #{}: {}", error,
|
||||
lib.display()).as_slice());
|
||||
continue
|
||||
}
|
||||
|
@ -48,31 +48,6 @@ pub struct ty_abbrev {
|
||||
|
||||
pub type abbrev_map = RefCell<HashMap<ty::t, ty_abbrev>>;
|
||||
|
||||
#[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; }
|
||||
|
@ -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)
|
||||
|
@ -1253,15 +1253,6 @@ impl cmt_ {
|
||||
}
|
||||
|
||||
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 @@ impl Repr for InteriorKind {
|
||||
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(),
|
||||
}
|
||||
|
@ -642,10 +642,6 @@ impl<'a> PrivacyVisitor<'a> {
|
||||
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),
|
||||
};
|
||||
|
@ -4070,16 +4070,6 @@ impl<'a> Resolver<'a> {
|
||||
|
||||
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 @@ impl<'a> Resolver<'a> {
|
||||
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 @@ impl<'a> Resolver<'a> {
|
||||
// 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,
|
||||
|
@ -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={}}}",
|
||||
|
@ -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, "<generic \\#{}>", self.to_uint())
|
||||
}
|
||||
#[cfg(not(stage0))]
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result{
|
||||
write!(f, "<generic #{}>", 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, "<generic integer \\#{}>", self.to_uint())
|
||||
}
|
||||
#[cfg(not(stage0))]
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "<generic integer #{}>", 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, "<generic float \\#{}>", self.to_uint())
|
||||
}
|
||||
#[cfg(not(stage0))]
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "<generic float #{}>", self.to_uint())
|
||||
}
|
||||
|
@ -1412,40 +1412,6 @@ impl<'a> LookupContext<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
#[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 @@ impl<'a> LookupContext<'a> {
|
||||
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 @@ impl<'a> LookupContext<'a> {
|
||||
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,
|
||||
|
@ -61,11 +61,6 @@ impl<V:InferStr> InferStr for Bound<V> {
|
||||
}
|
||||
|
||||
impl<T:InferStr> InferStr for Bounds<T> {
|
||||
#[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))
|
||||
}
|
||||
|
@ -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 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> String {
|
||||
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!("<generic \\#{}>", id),
|
||||
#[cfg(not(stage0))]
|
||||
None => format!("<generic #{}>", id),
|
||||
};
|
||||
if !cx.sess.verbose() {
|
||||
@ -758,13 +750,6 @@ impl Repr for ast::DefId {
|
||||
}
|
||||
|
||||
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 @@ impl Repr for ast::Visibility {
|
||||
}
|
||||
|
||||
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 @@ impl Repr for ty::FnSig {
|
||||
}
|
||||
|
||||
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),
|
||||
|
@ -91,7 +91,6 @@ impl fmt::Show for clean::Generics {
|
||||
|
||||
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(())
|
||||
}
|
||||
|
@ -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"<span class='attribute'>\#"));
|
||||
try!(write!(out, r"<span class='attribute'>#"));
|
||||
continue
|
||||
}
|
||||
t::RBRACKET => {
|
||||
|
@ -86,7 +86,7 @@ r##"<!DOCTYPE html>
|
||||
<dd>Move up in search results</dd>
|
||||
<dt>↓</dt>
|
||||
<dd>Move down in search results</dd>
|
||||
<dt>&\#9166;</dt>
|
||||
<dt>⏎</dt>
|
||||
<dd>Go to active search result</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
@ -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#"<h{lvl} id="{id}" class='section-header'><a
|
||||
href="\#{id}">{sec}{}</a></h{lvl}>"#,
|
||||
let text = format!(r##"<h{lvl} id="{id}" class='section-header'><a
|
||||
href="#{id}">{sec}{}</a></h{lvl}>"##,
|
||||
s, lvl = level, id = id,
|
||||
sec = if sec.len() == 0 {
|
||||
sec.to_string()
|
||||
|
@ -179,7 +179,7 @@ impl fmt::Show for Toc {
|
||||
// recursively format this table of contents (the
|
||||
// `{children}` is the key).
|
||||
try!(write!(fmt,
|
||||
"\n<li><a href=\"\\#{id}\">{num} {name}</a>{children}</li>",
|
||||
"\n<li><a href=\"#{id}\">{num} {name}</a>{children}</li>",
|
||||
id = entry.id,
|
||||
num = entry.sec_number, name = entry.name,
|
||||
children = entry.children))
|
||||
|
@ -136,7 +136,7 @@ fn runtest(test: &str, cratename: &str, libs: HashSet<Path>, 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<Writer:Send>);
|
||||
let mut err = old.unwrap_or(box io::stderr() as Box<Writer + Send>);
|
||||
io::util::copy(&mut p, &mut err).unwrap();
|
||||
});
|
||||
let emitter = diagnostic::EmitterWriter::new(box w2);
|
||||
|
@ -91,7 +91,7 @@ impl<T: 'static> LocalData for T {}
|
||||
// a proper map.
|
||||
#[doc(hidden)]
|
||||
pub type Map = Vec<Option<(*u8, TLSValue, uint)>>;
|
||||
type TLSValue = Box<LocalData:Send>;
|
||||
type TLSValue = Box<LocalData + Send>;
|
||||
|
||||
// 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 @@ impl<T: 'static> KeyValue<T> {
|
||||
// anything.
|
||||
let newval = data.map(|d| {
|
||||
let d = box d as Box<LocalData>;
|
||||
let d: Box<LocalData:Send> = unsafe { mem::transmute(d) };
|
||||
let d: Box<LocalData + Send> = unsafe { mem::transmute(d) };
|
||||
(keyval, d, 0)
|
||||
});
|
||||
|
||||
@ -236,7 +236,7 @@ impl<T: 'static> KeyValue<T> {
|
||||
// pointer part of the trait, (as ~T), and then use
|
||||
// compiler coercions to achieve a '&' pointer.
|
||||
let ptr = unsafe {
|
||||
let data = data as *Box<LocalData:Send> as *raw::TraitObject;
|
||||
let data = data as *Box<LocalData + Send> as *raw::TraitObject;
|
||||
&mut *((*data).data as *mut T)
|
||||
};
|
||||
Ref { _ptr: ptr, _index: pos, _nosend: marker::NoSend, _key: self }
|
||||
|
@ -25,11 +25,11 @@ use task::Task;
|
||||
|
||||
pub trait EventLoop {
|
||||
fn run(&mut self);
|
||||
fn callback(&mut self, arg: proc():Send);
|
||||
fn pausable_idle_callback(&mut self, Box<Callback:Send>)
|
||||
-> Box<PausableIdleCallback:Send>;
|
||||
fn remote_callback(&mut self, Box<Callback:Send>)
|
||||
-> Box<RemoteCallback:Send>;
|
||||
fn callback(&mut self, arg: proc(): Send);
|
||||
fn pausable_idle_callback(&mut self, Box<Callback + Send>)
|
||||
-> Box<PausableIdleCallback + Send>;
|
||||
fn remote_callback(&mut self, Box<Callback + Send>)
|
||||
-> Box<RemoteCallback + Send>;
|
||||
|
||||
/// 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 @@ impl<'a> LocalIo<'a> {
|
||||
pub trait IoFactory {
|
||||
// networking
|
||||
fn tcp_connect(&mut self, addr: SocketAddr,
|
||||
timeout: Option<u64>) -> IoResult<Box<RtioTcpStream:Send>>;
|
||||
timeout: Option<u64>) -> IoResult<Box<RtioTcpStream + Send>>;
|
||||
fn tcp_bind(&mut self, addr: SocketAddr)
|
||||
-> IoResult<Box<RtioTcpListener:Send>>;
|
||||
-> IoResult<Box<RtioTcpListener + Send>>;
|
||||
fn udp_bind(&mut self, addr: SocketAddr)
|
||||
-> IoResult<Box<RtioUdpSocket:Send>>;
|
||||
-> IoResult<Box<RtioUdpSocket + Send>>;
|
||||
fn unix_bind(&mut self, path: &CString)
|
||||
-> IoResult<Box<RtioUnixListener:Send>>;
|
||||
-> IoResult<Box<RtioUnixListener + Send>>;
|
||||
fn unix_connect(&mut self, path: &CString,
|
||||
timeout: Option<u64>) -> IoResult<Box<RtioPipe:Send>>;
|
||||
timeout: Option<u64>) -> IoResult<Box<RtioPipe + Send>>;
|
||||
fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
|
||||
hint: Option<AddrinfoHint>)
|
||||
-> IoResult<Vec<AddrinfoInfo>>;
|
||||
|
||||
// filesystem operations
|
||||
fn fs_from_raw_fd(&mut self, fd: c_int, close: CloseBehavior)
|
||||
-> Box<RtioFileStream:Send>;
|
||||
-> Box<RtioFileStream + Send>;
|
||||
fn fs_open(&mut self, path: &CString, fm: FileMode, fa: FileAccess)
|
||||
-> IoResult<Box<RtioFileStream:Send>>;
|
||||
-> IoResult<Box<RtioFileStream + Send>>;
|
||||
fn fs_unlink(&mut self, path: &CString) -> IoResult<()>;
|
||||
fn fs_stat(&mut self, path: &CString) -> IoResult<FileStat>;
|
||||
fn fs_mkdir(&mut self, path: &CString, mode: uint) -> IoResult<()>;
|
||||
@ -225,24 +225,24 @@ pub trait IoFactory {
|
||||
IoResult<()>;
|
||||
|
||||
// misc
|
||||
fn timer_init(&mut self) -> IoResult<Box<RtioTimer:Send>>;
|
||||
fn timer_init(&mut self) -> IoResult<Box<RtioTimer + Send>>;
|
||||
fn spawn(&mut self, cfg: ProcessConfig)
|
||||
-> IoResult<(Box<RtioProcess:Send>,
|
||||
Vec<Option<Box<RtioPipe:Send>>>)>;
|
||||
-> IoResult<(Box<RtioProcess + Send>,
|
||||
Vec<Option<Box<RtioPipe + Send>>>)>;
|
||||
fn kill(&mut self, pid: libc::pid_t, signal: int) -> IoResult<()>;
|
||||
fn pipe_open(&mut self, fd: c_int) -> IoResult<Box<RtioPipe:Send>>;
|
||||
fn pipe_open(&mut self, fd: c_int) -> IoResult<Box<RtioPipe + Send>>;
|
||||
fn tty_open(&mut self, fd: c_int, readable: bool)
|
||||
-> IoResult<Box<RtioTTY:Send>>;
|
||||
fn signal(&mut self, signal: int, cb: Box<Callback:Send>)
|
||||
-> IoResult<Box<RtioSignal:Send>>;
|
||||
-> IoResult<Box<RtioTTY + Send>>;
|
||||
fn signal(&mut self, signal: int, cb: Box<Callback + Send>)
|
||||
-> IoResult<Box<RtioSignal + Send>>;
|
||||
}
|
||||
|
||||
pub trait RtioTcpListener : RtioSocket {
|
||||
fn listen(~self) -> IoResult<Box<RtioTcpAcceptor:Send>>;
|
||||
fn listen(~self) -> IoResult<Box<RtioTcpAcceptor + Send>>;
|
||||
}
|
||||
|
||||
pub trait RtioTcpAcceptor : RtioSocket {
|
||||
fn accept(&mut self) -> IoResult<Box<RtioTcpStream:Send>>;
|
||||
fn accept(&mut self) -> IoResult<Box<RtioTcpStream + Send>>;
|
||||
fn accept_simultaneously(&mut self) -> IoResult<()>;
|
||||
fn dont_accept_simultaneously(&mut self) -> IoResult<()>;
|
||||
fn set_timeout(&mut self, timeout: Option<u64>);
|
||||
@ -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<RtioTcpStream:Send>;
|
||||
fn clone(&self) -> Box<RtioTcpStream + Send>;
|
||||
fn close_write(&mut self) -> IoResult<()>;
|
||||
fn close_read(&mut self) -> IoResult<()>;
|
||||
fn set_timeout(&mut self, timeout_ms: Option<u64>);
|
||||
@ -284,7 +284,7 @@ pub trait RtioUdpSocket : RtioSocket {
|
||||
fn hear_broadcasts(&mut self) -> IoResult<()>;
|
||||
fn ignore_broadcasts(&mut self) -> IoResult<()>;
|
||||
|
||||
fn clone(&self) -> Box<RtioUdpSocket:Send>;
|
||||
fn clone(&self) -> Box<RtioUdpSocket + Send>;
|
||||
fn set_timeout(&mut self, timeout_ms: Option<u64>);
|
||||
fn set_read_timeout(&mut self, timeout_ms: Option<u64>);
|
||||
fn set_write_timeout(&mut self, timeout_ms: Option<u64>);
|
||||
@ -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<Callback:Send>);
|
||||
fn period(&mut self, msecs: u64, cb: Box<Callback:Send>);
|
||||
fn oneshot(&mut self, msecs: u64, cb: Box<Callback + Send>);
|
||||
fn period(&mut self, msecs: u64, cb: Box<Callback + Send>);
|
||||
}
|
||||
|
||||
pub trait RtioFileStream {
|
||||
@ -319,7 +319,7 @@ pub trait RtioProcess {
|
||||
pub trait RtioPipe {
|
||||
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint>;
|
||||
fn write(&mut self, buf: &[u8]) -> IoResult<()>;
|
||||
fn clone(&self) -> Box<RtioPipe:Send>;
|
||||
fn clone(&self) -> Box<RtioPipe + Send>;
|
||||
|
||||
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<Box<RtioUnixAcceptor:Send>>;
|
||||
fn listen(~self) -> IoResult<Box<RtioUnixAcceptor + Send>>;
|
||||
}
|
||||
|
||||
pub trait RtioUnixAcceptor {
|
||||
fn accept(&mut self) -> IoResult<Box<RtioPipe:Send>>;
|
||||
fn accept(&mut self) -> IoResult<Box<RtioPipe + Send>>;
|
||||
fn set_timeout(&mut self, timeout: Option<u64>);
|
||||
}
|
||||
|
||||
|
@ -46,12 +46,12 @@ pub struct Task {
|
||||
pub destroyed: bool,
|
||||
pub name: Option<SendStr>,
|
||||
|
||||
imp: Option<Box<Runtime:Send>>,
|
||||
imp: Option<Box<Runtime + Send>>,
|
||||
}
|
||||
|
||||
pub struct TaskOpts {
|
||||
/// Invoke this procedure with the result of the task when it finishes.
|
||||
pub on_exit: Option<proc(Result):Send>,
|
||||
pub on_exit: Option<proc(Result): Send>,
|
||||
/// A name for the task-to-be, for identification in failure messages
|
||||
pub name: Option<SendStr>,
|
||||
/// 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<Any:Send>>;
|
||||
pub type Result = ::core::result::Result<(), Box<Any + Send>>;
|
||||
|
||||
pub struct GarbageCollector;
|
||||
pub struct LocalStorage(pub Option<local_data::Map>);
|
||||
@ -79,7 +79,7 @@ pub enum BlockedTask {
|
||||
|
||||
/// Per-task state related to task death, killing, failure, etc.
|
||||
pub struct Death {
|
||||
pub on_exit: Option<proc(Result):Send>,
|
||||
pub on_exit: Option<proc(Result): Send>,
|
||||
}
|
||||
|
||||
pub struct BlockedTasks {
|
||||
@ -177,7 +177,7 @@ impl Task {
|
||||
/// 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<Runtime:Send>) {
|
||||
pub fn put_runtime(&mut self, ops: Box<Runtime + Send>) {
|
||||
assert!(self.imp.is_none());
|
||||
self.imp = Some(ops);
|
||||
}
|
||||
@ -207,7 +207,7 @@ impl Task {
|
||||
Ok(t) => Some(t),
|
||||
Err(t) => {
|
||||
let data = mem::transmute::<_, raw::TraitObject>(t).data;
|
||||
let obj: Box<Runtime:Send> =
|
||||
let obj: Box<Runtime + Send> =
|
||||
mem::transmute(raw::TraitObject {
|
||||
vtable: vtable,
|
||||
data: data,
|
||||
@ -221,7 +221,7 @@ impl Task {
|
||||
|
||||
/// 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)
|
||||
}
|
||||
|
@ -78,15 +78,15 @@ use uw = libunwind;
|
||||
|
||||
pub struct Unwinder {
|
||||
unwinding: bool,
|
||||
cause: Option<Box<Any:Send>>
|
||||
cause: Option<Box<Any + Send>>
|
||||
}
|
||||
|
||||
struct Exception {
|
||||
uwe: uw::_Unwind_Exception,
|
||||
cause: Option<Box<Any:Send>>,
|
||||
cause: Option<Box<Any + Send>>,
|
||||
}
|
||||
|
||||
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 @@ impl Unwinder {
|
||||
/// 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<Any:Send>> {
|
||||
pub unsafe fn try(f: ||) -> ::core::result::Result<(), Box<Any + Send>> {
|
||||
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 @@ pub unsafe fn try(f: ||) -> ::core::result::Result<(), Box<Any:Send>> {
|
||||
// An uninlined, unmangled function upon which to slap yer breakpoints
|
||||
#[inline(never)]
|
||||
#[no_mangle]
|
||||
fn rust_fail(cause: Box<Any:Send>) -> ! {
|
||||
fn rust_fail(cause: Box<Any + Send>) -> ! {
|
||||
rtdebug!("begin_unwind()");
|
||||
|
||||
unsafe {
|
||||
@ -400,7 +400,7 @@ pub fn begin_unwind<M: Any + Send>(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<Any:Send>,
|
||||
fn begin_unwind_inner(msg: Box<Any + Send>,
|
||||
file: &'static str,
|
||||
line: uint) -> ! {
|
||||
// First, invoke call the user-defined callbacks triggered on task failure.
|
||||
|
@ -27,12 +27,12 @@ pub struct AsyncWatcher {
|
||||
}
|
||||
|
||||
struct Payload {
|
||||
callback: Box<Callback:Send>,
|
||||
callback: Box<Callback + Send>,
|
||||
exit_flag: Arc<Exclusive<bool>>,
|
||||
}
|
||||
|
||||
impl AsyncWatcher {
|
||||
pub fn new(loop_: &mut Loop, cb: Box<Callback:Send>) -> AsyncWatcher {
|
||||
pub fn new(loop_: &mut Loop, cb: Box<Callback + Send>) -> AsyncWatcher {
|
||||
let handle = UvHandle::alloc(None::<AsyncWatcher>, uvll::UV_ASYNC);
|
||||
assert_eq!(unsafe {
|
||||
uvll::uv_async_init(loop_.handle, handle, async_cb)
|
||||
|
@ -18,11 +18,11 @@ use std::rt::rtio::{Callback, PausableIdleCallback};
|
||||
pub struct IdleWatcher {
|
||||
handle: *uvll::uv_idle_t,
|
||||
idle_flag: bool,
|
||||
callback: Box<Callback:Send>,
|
||||
callback: Box<Callback + Send>,
|
||||
}
|
||||
|
||||
impl IdleWatcher {
|
||||
pub fn new(loop_: &mut Loop, cb: Box<Callback:Send>) -> Box<IdleWatcher> {
|
||||
pub fn new(loop_: &mut Loop, cb: Box<Callback + Send>) -> Box<IdleWatcher> {
|
||||
let handle = UvHandle::alloc(None::<IdleWatcher>, uvll::UV_IDLE);
|
||||
assert_eq!(unsafe {
|
||||
uvll::uv_idle_init(loop_.handle, handle)
|
||||
@ -127,7 +127,7 @@ mod test {
|
||||
fn mk(v: uint) -> (Box<IdleWatcher>, Chan) {
|
||||
let rc = Rc::new(RefCell::new((None, 0)));
|
||||
let cb = box MyCallback(rc.clone(), v);
|
||||
let cb = cb as Box<Callback:>;
|
||||
let cb = cb as Box<Callback>;
|
||||
let cb = unsafe { mem::transmute(cb) };
|
||||
(IdleWatcher::new(&mut local_loop().loop_, cb), rc)
|
||||
}
|
||||
|
@ -125,8 +125,8 @@ pub mod stream;
|
||||
/// // this code is running inside of a green task powered by libuv
|
||||
/// }
|
||||
/// ```
|
||||
pub fn event_loop() -> Box<rtio::EventLoop:Send> {
|
||||
box uvio::UvEventLoop::new() as Box<rtio::EventLoop:Send>
|
||||
pub fn event_loop() -> Box<rtio::EventLoop + Send> {
|
||||
box uvio::UvEventLoop::new() as Box<rtio::EventLoop + Send>
|
||||
}
|
||||
|
||||
/// A type that wraps a uv handle
|
||||
|
@ -165,8 +165,8 @@ pub struct TcpWatcher {
|
||||
pub struct TcpListener {
|
||||
home: HomeHandle,
|
||||
handle: *uvll::uv_pipe_t,
|
||||
outgoing: Sender<Result<Box<rtio::RtioTcpStream:Send>, IoError>>,
|
||||
incoming: Receiver<Result<Box<rtio::RtioTcpStream:Send>, IoError>>,
|
||||
outgoing: Sender<Result<Box<rtio::RtioTcpStream + Send>, IoError>>,
|
||||
incoming: Receiver<Result<Box<rtio::RtioTcpStream + Send>, IoError>>,
|
||||
}
|
||||
|
||||
pub struct TcpAcceptor {
|
||||
@ -274,7 +274,7 @@ impl rtio::RtioTcpStream for TcpWatcher {
|
||||
})
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<rtio::RtioTcpStream:Send> {
|
||||
fn clone(&self) -> Box<rtio::RtioTcpStream + Send> {
|
||||
box TcpWatcher {
|
||||
handle: self.handle,
|
||||
stream: StreamWatcher::new(self.handle),
|
||||
@ -282,7 +282,7 @@ impl rtio::RtioTcpStream for TcpWatcher {
|
||||
refcount: self.refcount.clone(),
|
||||
read_access: self.read_access.clone(),
|
||||
write_access: self.write_access.clone(),
|
||||
} as Box<rtio::RtioTcpStream:Send>
|
||||
} as Box<rtio::RtioTcpStream + Send>
|
||||
}
|
||||
|
||||
fn close_read(&mut self) -> Result<(), IoError> {
|
||||
@ -388,7 +388,7 @@ impl rtio::RtioSocket for TcpListener {
|
||||
}
|
||||
|
||||
impl rtio::RtioTcpListener for TcpListener {
|
||||
fn listen(~self) -> Result<Box<rtio::RtioTcpAcceptor:Send>, IoError> {
|
||||
fn listen(~self) -> Result<Box<rtio::RtioTcpAcceptor + Send>, IoError> {
|
||||
// create the acceptor object from ourselves
|
||||
let mut acceptor = box TcpAcceptor {
|
||||
listener: self,
|
||||
@ -398,7 +398,7 @@ impl rtio::RtioTcpListener for TcpListener {
|
||||
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<rtio::RtioTcpAcceptor:Send>),
|
||||
0 => Ok(acceptor as Box<rtio::RtioTcpAcceptor + Send>),
|
||||
n => Err(uv_error_to_io_error(UvError(n))),
|
||||
}
|
||||
}
|
||||
@ -414,7 +414,7 @@ extern fn listen_cb(server: *uvll::uv_stream_t, status: c_int) {
|
||||
});
|
||||
let client = TcpWatcher::new_home(&loop_, tcp.home().clone());
|
||||
assert_eq!(unsafe { uvll::uv_accept(server, client.handle) }, 0);
|
||||
Ok(box client as Box<rtio::RtioTcpStream:Send>)
|
||||
Ok(box client as Box<rtio::RtioTcpStream + Send>)
|
||||
}
|
||||
n => Err(uv_error_to_io_error(UvError(n)))
|
||||
};
|
||||
@ -442,7 +442,7 @@ impl rtio::RtioSocket for TcpAcceptor {
|
||||
}
|
||||
|
||||
impl rtio::RtioTcpAcceptor for TcpAcceptor {
|
||||
fn accept(&mut self) -> Result<Box<rtio::RtioTcpStream:Send>, IoError> {
|
||||
fn accept(&mut self) -> Result<Box<rtio::RtioTcpStream + Send>, IoError> {
|
||||
self.timeout.accept(&self.listener.incoming)
|
||||
}
|
||||
|
||||
@ -740,7 +740,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
|
||||
})
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<rtio::RtioUdpSocket:Send> {
|
||||
fn clone(&self) -> Box<rtio::RtioUdpSocket + Send> {
|
||||
box UdpWatcher {
|
||||
handle: self.handle,
|
||||
home: self.home.clone(),
|
||||
@ -748,7 +748,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
|
||||
write_access: self.write_access.clone(),
|
||||
read_access: self.read_access.clone(),
|
||||
blocked_sender: None,
|
||||
} as Box<rtio::RtioUdpSocket:Send>
|
||||
} as Box<rtio::RtioUdpSocket + Send>
|
||||
}
|
||||
|
||||
fn set_timeout(&mut self, timeout: Option<u64>) {
|
||||
|
@ -38,8 +38,8 @@ pub struct PipeWatcher {
|
||||
pub struct PipeListener {
|
||||
home: HomeHandle,
|
||||
pipe: *uvll::uv_pipe_t,
|
||||
outgoing: Sender<IoResult<Box<rtio::RtioPipe:Send>>>,
|
||||
incoming: Receiver<IoResult<Box<rtio::RtioPipe:Send>>>,
|
||||
outgoing: Sender<IoResult<Box<rtio::RtioPipe + Send>>>,
|
||||
incoming: Receiver<IoResult<Box<rtio::RtioPipe + Send>>>,
|
||||
}
|
||||
|
||||
pub struct PipeAcceptor {
|
||||
@ -129,7 +129,7 @@ impl rtio::RtioPipe for PipeWatcher {
|
||||
self.stream.write(buf, guard.can_timeout).map_err(uv_error_to_io_error)
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<rtio::RtioPipe:Send> {
|
||||
fn clone(&self) -> Box<rtio::RtioPipe + Send> {
|
||||
box PipeWatcher {
|
||||
stream: StreamWatcher::new(self.stream.handle),
|
||||
defused: false,
|
||||
@ -137,7 +137,7 @@ impl rtio::RtioPipe for PipeWatcher {
|
||||
refcount: self.refcount.clone(),
|
||||
read_access: self.read_access.clone(),
|
||||
write_access: self.write_access.clone(),
|
||||
} as Box<rtio::RtioPipe:Send>
|
||||
} as Box<rtio::RtioPipe + Send>
|
||||
}
|
||||
|
||||
fn close_read(&mut self) -> IoResult<()> {
|
||||
@ -248,7 +248,7 @@ impl PipeListener {
|
||||
}
|
||||
|
||||
impl rtio::RtioUnixListener for PipeListener {
|
||||
fn listen(~self) -> IoResult<Box<rtio::RtioUnixAcceptor:Send>> {
|
||||
fn listen(~self) -> IoResult<Box<rtio::RtioUnixAcceptor + Send>> {
|
||||
// create the acceptor object from ourselves
|
||||
let mut acceptor = box PipeAcceptor {
|
||||
listener: self,
|
||||
@ -258,7 +258,7 @@ impl rtio::RtioUnixListener for PipeListener {
|
||||
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<rtio::RtioUnixAcceptor:Send>),
|
||||
0 => Ok(acceptor as Box<rtio::RtioUnixAcceptor + Send>),
|
||||
n => Err(uv_error_to_io_error(UvError(n))),
|
||||
}
|
||||
}
|
||||
@ -283,7 +283,7 @@ extern fn listen_cb(server: *uvll::uv_stream_t, status: libc::c_int) {
|
||||
});
|
||||
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<rtio::RtioPipe:Send>)
|
||||
Ok(box client as Box<rtio::RtioPipe + Send>)
|
||||
}
|
||||
n => Err(uv_error_to_io_error(UvError(n)))
|
||||
};
|
||||
@ -300,7 +300,7 @@ impl Drop for PipeListener {
|
||||
// PipeAcceptor implementation and traits
|
||||
|
||||
impl rtio::RtioUnixAcceptor for PipeAcceptor {
|
||||
fn accept(&mut self) -> IoResult<Box<rtio::RtioPipe:Send>> {
|
||||
fn accept(&mut self) -> IoResult<Box<rtio::RtioPipe + Send>> {
|
||||
self.timeout.accept(&self.listener.incoming)
|
||||
}
|
||||
|
||||
|
@ -20,11 +20,11 @@ pub struct SignalWatcher {
|
||||
handle: *uvll::uv_signal_t,
|
||||
home: HomeHandle,
|
||||
|
||||
cb: Box<Callback:Send>,
|
||||
cb: Box<Callback + Send>,
|
||||
}
|
||||
|
||||
impl SignalWatcher {
|
||||
pub fn new(io: &mut UvIoFactory, signum: int, cb: Box<Callback:Send>)
|
||||
pub fn new(io: &mut UvIoFactory, signum: int, cb: Box<Callback + Send>)
|
||||
-> Result<Box<SignalWatcher>, UvError> {
|
||||
let s = box SignalWatcher {
|
||||
handle: UvHandle::alloc(None::<SignalWatcher>, uvll::UV_SIGNAL),
|
||||
|
@ -27,8 +27,8 @@ pub struct TimerWatcher {
|
||||
|
||||
pub enum NextAction {
|
||||
WakeTask,
|
||||
CallOnce(Box<Callback:Send>),
|
||||
CallMany(Box<Callback:Send>, uint),
|
||||
CallOnce(Box<Callback + Send>),
|
||||
CallMany(Box<Callback + Send>, uint),
|
||||
}
|
||||
|
||||
impl TimerWatcher {
|
||||
@ -103,7 +103,7 @@ impl RtioTimer for TimerWatcher {
|
||||
self.stop();
|
||||
}
|
||||
|
||||
fn oneshot(&mut self, msecs: u64, cb: Box<Callback:Send>) {
|
||||
fn oneshot(&mut self, msecs: u64, cb: Box<Callback + Send>) {
|
||||
// similarly to the destructor, we must drop the previous action outside
|
||||
// of the homing missile
|
||||
let _prev_action = {
|
||||
@ -115,7 +115,7 @@ impl RtioTimer for TimerWatcher {
|
||||
};
|
||||
}
|
||||
|
||||
fn period(&mut self, msecs: u64, cb: Box<Callback:Send>) {
|
||||
fn period(&mut self, msecs: u64, cb: Box<Callback + Send>) {
|
||||
// similarly to the destructor, we must drop the previous action outside
|
||||
// of the homing missile
|
||||
let _prev_action = {
|
||||
|
@ -84,16 +84,16 @@ impl EventLoop for UvEventLoop {
|
||||
IdleWatcher::onetime(&mut self.uvio.loop_, f);
|
||||
}
|
||||
|
||||
fn pausable_idle_callback(&mut self, cb: Box<rtio::Callback:Send>)
|
||||
-> Box<rtio::PausableIdleCallback:Send> {
|
||||
fn pausable_idle_callback(&mut self, cb: Box<rtio::Callback + Send>)
|
||||
-> Box<rtio::PausableIdleCallback + Send> {
|
||||
IdleWatcher::new(&mut self.uvio.loop_, cb)
|
||||
as Box<rtio::PausableIdleCallback:Send>
|
||||
as Box<rtio::PausableIdleCallback + Send>
|
||||
}
|
||||
|
||||
fn remote_callback(&mut self, f: Box<rtio::Callback:Send>)
|
||||
-> Box<rtio::RemoteCallback:Send> {
|
||||
fn remote_callback(&mut self, f: Box<rtio::Callback + Send>)
|
||||
-> Box<rtio::RemoteCallback + Send> {
|
||||
box AsyncWatcher::new(&mut self.uvio.loop_, f) as
|
||||
Box<rtio::RemoteCallback:Send>
|
||||
Box<rtio::RemoteCallback + Send>
|
||||
}
|
||||
|
||||
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<u64>)
|
||||
-> IoResult<Box<rtio::RtioTcpStream:Send>> {
|
||||
-> IoResult<Box<rtio::RtioTcpStream + Send>> {
|
||||
match TcpWatcher::connect(self, addr, timeout) {
|
||||
Ok(t) => Ok(box t as Box<rtio::RtioTcpStream:Send>),
|
||||
Ok(t) => Ok(box t as Box<rtio::RtioTcpStream + Send>),
|
||||
Err(e) => Err(uv_error_to_io_error(e)),
|
||||
}
|
||||
}
|
||||
|
||||
fn tcp_bind(&mut self, addr: rtio::SocketAddr)
|
||||
-> IoResult<Box<rtio::RtioTcpListener:Send>> {
|
||||
-> IoResult<Box<rtio::RtioTcpListener + Send>> {
|
||||
match TcpListener::bind(self, addr) {
|
||||
Ok(t) => Ok(t as Box<rtio::RtioTcpListener:Send>),
|
||||
Ok(t) => Ok(t as Box<rtio::RtioTcpListener + Send>),
|
||||
Err(e) => Err(uv_error_to_io_error(e)),
|
||||
}
|
||||
}
|
||||
|
||||
fn udp_bind(&mut self, addr: rtio::SocketAddr)
|
||||
-> IoResult<Box<rtio::RtioUdpSocket:Send>> {
|
||||
-> IoResult<Box<rtio::RtioUdpSocket + Send>> {
|
||||
match UdpWatcher::bind(self, addr) {
|
||||
Ok(u) => Ok(box u as Box<rtio::RtioUdpSocket:Send>),
|
||||
Ok(u) => Ok(box u as Box<rtio::RtioUdpSocket + Send>),
|
||||
Err(e) => Err(uv_error_to_io_error(e)),
|
||||
}
|
||||
}
|
||||
|
||||
fn timer_init(&mut self) -> IoResult<Box<rtio::RtioTimer:Send>> {
|
||||
Ok(TimerWatcher::new(self) as Box<rtio::RtioTimer:Send>)
|
||||
fn timer_init(&mut self) -> IoResult<Box<rtio::RtioTimer + Send>> {
|
||||
Ok(TimerWatcher::new(self) as Box<rtio::RtioTimer + Send>)
|
||||
}
|
||||
|
||||
fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
|
||||
@ -177,14 +177,14 @@ impl IoFactory for UvIoFactory {
|
||||
}
|
||||
|
||||
fn fs_from_raw_fd(&mut self, fd: c_int, close: rtio::CloseBehavior)
|
||||
-> Box<rtio::RtioFileStream:Send> {
|
||||
-> Box<rtio::RtioFileStream + Send> {
|
||||
box FileWatcher::new(self, fd, close) as
|
||||
Box<rtio::RtioFileStream:Send>
|
||||
Box<rtio::RtioFileStream + Send>
|
||||
}
|
||||
|
||||
fn fs_open(&mut self, path: &CString, fm: rtio::FileMode,
|
||||
fa: rtio::FileAccess)
|
||||
-> IoResult<Box<rtio::RtioFileStream:Send>>
|
||||
-> IoResult<Box<rtio::RtioFileStream + Send>>
|
||||
{
|
||||
let flags = match fm {
|
||||
rtio::Open => 0,
|
||||
@ -201,7 +201,7 @@ impl IoFactory for UvIoFactory {
|
||||
};
|
||||
|
||||
match FsRequest::open(self, path, flags as int, mode as int) {
|
||||
Ok(fs) => Ok(box fs as Box<rtio::RtioFileStream:Send>),
|
||||
Ok(fs) => Ok(box fs as Box<rtio::RtioFileStream + Send>),
|
||||
Err(e) => Err(uv_error_to_io_error(e))
|
||||
}
|
||||
}
|
||||
@ -264,14 +264,14 @@ impl IoFactory for UvIoFactory {
|
||||
}
|
||||
|
||||
fn spawn(&mut self, cfg: ProcessConfig)
|
||||
-> IoResult<(Box<rtio::RtioProcess:Send>,
|
||||
Vec<Option<Box<rtio::RtioPipe:Send>>>)>
|
||||
-> IoResult<(Box<rtio::RtioProcess + Send>,
|
||||
Vec<Option<Box<rtio::RtioPipe + Send>>>)>
|
||||
{
|
||||
match Process::spawn(self, cfg) {
|
||||
Ok((p, io)) => {
|
||||
Ok((p as Box<rtio::RtioProcess:Send>,
|
||||
Ok((p as Box<rtio::RtioProcess + Send>,
|
||||
io.move_iter().map(|i| i.map(|p| {
|
||||
box p as Box<rtio::RtioPipe:Send>
|
||||
box p as Box<rtio::RtioPipe + Send>
|
||||
})).collect()))
|
||||
}
|
||||
Err(e) => Err(uv_error_to_io_error(e)),
|
||||
@ -283,43 +283,43 @@ impl IoFactory for UvIoFactory {
|
||||
}
|
||||
|
||||
fn unix_bind(&mut self, path: &CString)
|
||||
-> IoResult<Box<rtio::RtioUnixListener:Send>> {
|
||||
-> IoResult<Box<rtio::RtioUnixListener + Send>> {
|
||||
match PipeListener::bind(self, path) {
|
||||
Ok(p) => Ok(p as Box<rtio::RtioUnixListener:Send>),
|
||||
Ok(p) => Ok(p as Box<rtio::RtioUnixListener + Send>),
|
||||
Err(e) => Err(uv_error_to_io_error(e)),
|
||||
}
|
||||
}
|
||||
|
||||
fn unix_connect(&mut self, path: &CString, timeout: Option<u64>)
|
||||
-> IoResult<Box<rtio::RtioPipe:Send>> {
|
||||
-> IoResult<Box<rtio::RtioPipe + Send>> {
|
||||
match PipeWatcher::connect(self, path, timeout) {
|
||||
Ok(p) => Ok(box p as Box<rtio::RtioPipe:Send>),
|
||||
Ok(p) => Ok(box p as Box<rtio::RtioPipe + Send>),
|
||||
Err(e) => Err(uv_error_to_io_error(e)),
|
||||
}
|
||||
}
|
||||
|
||||
fn tty_open(&mut self, fd: c_int, readable: bool)
|
||||
-> IoResult<Box<rtio::RtioTTY:Send>> {
|
||||
-> IoResult<Box<rtio::RtioTTY + Send>> {
|
||||
match TtyWatcher::new(self, fd, readable) {
|
||||
Ok(tty) => Ok(box tty as Box<rtio::RtioTTY:Send>),
|
||||
Ok(tty) => Ok(box tty as Box<rtio::RtioTTY + Send>),
|
||||
Err(e) => Err(uv_error_to_io_error(e))
|
||||
}
|
||||
}
|
||||
|
||||
fn pipe_open(&mut self, fd: c_int)
|
||||
-> IoResult<Box<rtio::RtioPipe:Send>>
|
||||
-> IoResult<Box<rtio::RtioPipe + Send>>
|
||||
{
|
||||
match PipeWatcher::open(self, fd) {
|
||||
Ok(s) => Ok(box s as Box<rtio::RtioPipe:Send>),
|
||||
Ok(s) => Ok(box s as Box<rtio::RtioPipe + Send>),
|
||||
Err(e) => Err(uv_error_to_io_error(e))
|
||||
}
|
||||
}
|
||||
|
||||
fn signal(&mut self, signum: int, cb: Box<rtio::Callback:Send>)
|
||||
-> IoResult<Box<rtio::RtioSignal:Send>>
|
||||
fn signal(&mut self, signum: int, cb: Box<rtio::Callback + Send>)
|
||||
-> IoResult<Box<rtio::RtioSignal + Send>>
|
||||
{
|
||||
match SignalWatcher::new(self, signum, cb) {
|
||||
Ok(s) => Ok(s as Box<rtio::RtioSignal:Send>),
|
||||
Ok(s) => Ok(s as Box<rtio::RtioSignal + Send>),
|
||||
Err(e) => Err(uv_error_to_io_error(e)),
|
||||
}
|
||||
}
|
||||
|
@ -430,26 +430,6 @@ impl<'a> ::Encoder<io::IoError> for Encoder<'a> {
|
||||
_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 @@ impl<'a> ::Encoder<io::IoError> for Encoder<'a> {
|
||||
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 @@ impl<'a> ::Encoder<io::IoError> for Encoder<'a> {
|
||||
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 @@ impl<'a> ::Encoder<io::IoError> for PrettyEncoder<'a> {
|
||||
}
|
||||
|
||||
|
||||
#[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 @@ impl<'a> ::Encoder<io::IoError> for PrettyEncoder<'a> {
|
||||
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 {
|
||||
|
@ -1424,18 +1424,6 @@ impl<K: Eq + Hash<S>, V: PartialEq, S, H: Hasher<S>> PartialEq for HashMap<K, V,
|
||||
impl<K: Eq + Hash<S>, V: Eq, S, H: Hasher<S>> Eq for HashMap<K, V, H> {}
|
||||
|
||||
impl<K: Eq + Hash<S> + Show, V: Show, S, H: Hasher<S>> Show for HashMap<K, V, H> {
|
||||
#[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 @@ impl<T: Eq + Hash<S>, S, H: Hasher<S>> HashSet<T, H> {
|
||||
}
|
||||
|
||||
impl<T: Eq + Hash<S> + fmt::Show, S, H: Hasher<S>> fmt::Show for HashSet<T, H> {
|
||||
#[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, "{{"));
|
||||
|
||||
|
@ -208,26 +208,6 @@ impl<K: Hash + Eq, V> LruCache<K, V> {
|
||||
impl<A: fmt::Show + Hash + Eq, B: fmt::Show> fmt::Show for LruCache<A, B> {
|
||||
/// 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;
|
||||
|
@ -23,7 +23,7 @@ use str::Str;
|
||||
use string::String;
|
||||
|
||||
// Defined in this module instead of io::stdio so that the unwinding
|
||||
local_data_key!(pub local_stderr: Box<Writer:Send>)
|
||||
local_data_key!(pub local_stderr: Box<Writer + Send>)
|
||||
|
||||
impl Writer for Stdio {
|
||||
fn write(&mut self, bytes: &[u8]) -> IoResult<()> {
|
||||
@ -35,7 +35,7 @@ impl Writer for Stdio {
|
||||
}
|
||||
}
|
||||
|
||||
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::<String>() {
|
||||
|
@ -84,7 +84,7 @@ use vec::Vec;
|
||||
/// configured at creation time, via the `FileAccess` parameter to
|
||||
/// `File::open_mode()`.
|
||||
pub struct File {
|
||||
fd: Box<rtio::RtioFileStream:Send>,
|
||||
fd: Box<rtio::RtioFileStream + Send>,
|
||||
path: Path,
|
||||
last_nread: int,
|
||||
}
|
||||
|
@ -51,11 +51,11 @@ use rt::rtio;
|
||||
/// drop(stream); // close the connection
|
||||
/// ```
|
||||
pub struct TcpStream {
|
||||
obj: Box<RtioTcpStream:Send>,
|
||||
obj: Box<RtioTcpStream + Send>,
|
||||
}
|
||||
|
||||
impl TcpStream {
|
||||
fn new(s: Box<RtioTcpStream:Send>) -> TcpStream {
|
||||
fn new(s: Box<RtioTcpStream + Send>) -> TcpStream {
|
||||
TcpStream { obj: s }
|
||||
}
|
||||
|
||||
@ -326,7 +326,7 @@ impl Writer for TcpStream {
|
||||
/// # }
|
||||
/// ```
|
||||
pub struct TcpListener {
|
||||
obj: Box<RtioTcpListener:Send>,
|
||||
obj: Box<RtioTcpListener + Send>,
|
||||
}
|
||||
|
||||
impl TcpListener {
|
||||
@ -382,7 +382,7 @@ impl Listener<TcpStream, TcpAcceptor> for TcpListener {
|
||||
/// a `TcpListener`'s `listen` method, and this object can be used to accept new
|
||||
/// `TcpStream` instances.
|
||||
pub struct TcpAcceptor {
|
||||
obj: Box<RtioTcpAcceptor:Send>,
|
||||
obj: Box<RtioTcpAcceptor + Send>,
|
||||
}
|
||||
|
||||
impl TcpAcceptor {
|
||||
|
@ -57,7 +57,7 @@ use rt::rtio;
|
||||
/// drop(socket); // close the socket
|
||||
/// ```
|
||||
pub struct UdpSocket {
|
||||
obj: Box<RtioUdpSocket:Send>,
|
||||
obj: Box<RtioUdpSocket + Send>,
|
||||
}
|
||||
|
||||
impl UdpSocket {
|
||||
|
@ -36,7 +36,7 @@ use rt::rtio::{RtioUnixAcceptor, RtioPipe};
|
||||
|
||||
/// A stream which communicates over a named pipe.
|
||||
pub struct UnixStream {
|
||||
obj: Box<RtioPipe:Send>,
|
||||
obj: Box<RtioPipe + Send>,
|
||||
}
|
||||
|
||||
impl UnixStream {
|
||||
@ -144,7 +144,7 @@ impl Writer for UnixStream {
|
||||
/// A value that can listen for incoming named pipe connection requests.
|
||||
pub struct UnixListener {
|
||||
/// The internal, opaque runtime Unix listener.
|
||||
obj: Box<RtioUnixListener:Send>,
|
||||
obj: Box<RtioUnixListener + Send>,
|
||||
}
|
||||
|
||||
impl UnixListener {
|
||||
@ -188,7 +188,7 @@ impl Listener<UnixStream, UnixAcceptor> for UnixListener {
|
||||
/// A value that can accept named pipe connections, returned from `listen()`.
|
||||
pub struct UnixAcceptor {
|
||||
/// The internal, opaque runtime Unix acceptor.
|
||||
obj: Box<RtioUnixAcceptor:Send>,
|
||||
obj: Box<RtioUnixAcceptor + Send>,
|
||||
}
|
||||
|
||||
impl UnixAcceptor {
|
||||
|
@ -24,7 +24,7 @@ use rt::rtio::{RtioPipe, LocalIo};
|
||||
/// A synchronous, in-memory pipe.
|
||||
pub struct PipeStream {
|
||||
/// The internal, opaque runtime pipe object.
|
||||
obj: Box<RtioPipe:Send>,
|
||||
obj: Box<RtioPipe + Send>,
|
||||
}
|
||||
|
||||
impl PipeStream {
|
||||
@ -55,7 +55,7 @@ impl PipeStream {
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub fn new(inner: Box<RtioPipe:Send>) -> PipeStream {
|
||||
pub fn new(inner: Box<RtioPipe + Send>) -> PipeStream {
|
||||
PipeStream { obj: inner }
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ use c_str::CString;
|
||||
/// assert!(child.wait().unwrap().success());
|
||||
/// ```
|
||||
pub struct Process {
|
||||
handle: Box<RtioProcess:Send>,
|
||||
handle: Box<RtioProcess + Send>,
|
||||
|
||||
/// Handle to the child's stdin, if the `stdin` field of this process's
|
||||
/// `ProcessConfig` was `CreatePipe`. By default, this handle is `Some`.
|
||||
|
@ -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<RtioSignal:Send>)>,
|
||||
handles: Vec<(Signum, Box<RtioSignal + Send>)>,
|
||||
/// This is where all the handles send signums, which are received by
|
||||
/// the clients from the receiver.
|
||||
tx: Sender<Signum>,
|
||||
|
@ -71,8 +71,8 @@ use str::StrSlice;
|
||||
// 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<RtioTTY:Send>),
|
||||
File(Box<RtioFileStream:Send>),
|
||||
TTY(Box<RtioTTY + Send>),
|
||||
File(Box<RtioFileStream + Send>),
|
||||
}
|
||||
|
||||
fn src<T>(fd: libc::c_int, readable: bool, f: |StdSource| -> T) -> T {
|
||||
@ -84,7 +84,7 @@ fn src<T>(fd: libc::c_int, readable: bool, f: |StdSource| -> T) -> T {
|
||||
}).map_err(IoError::from_rtio_error).unwrap()
|
||||
}
|
||||
|
||||
local_data_key!(local_stdout: Box<Writer:Send>)
|
||||
local_data_key!(local_stdout: Box<Writer + Send>)
|
||||
|
||||
/// 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<Writer:Send>) -> Option<Box<Writer:Send>> {
|
||||
pub fn set_stdout(stdout: Box<Writer + Send>) -> Option<Box<Writer + Send>> {
|
||||
local_stdout.replace(Some(stdout)).and_then(|mut s| {
|
||||
let _ = s.flush();
|
||||
Some(s)
|
||||
@ -178,7 +178,7 @@ pub fn set_stdout(stdout: Box<Writer:Send>) -> Option<Box<Writer:Send>> {
|
||||
///
|
||||
/// 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<Writer:Send>) -> Option<Box<Writer:Send>> {
|
||||
pub fn set_stderr(stderr: Box<Writer + Send>) -> Option<Box<Writer + Send>> {
|
||||
local_stderr.replace(Some(stderr)).and_then(|mut s| {
|
||||
let _ = s.flush();
|
||||
Some(s)
|
||||
@ -198,7 +198,7 @@ pub fn set_stderr(stderr: Box<Writer:Send>) -> Option<Box<Writer:Send>> {
|
||||
fn with_task_stdout(f: |&mut Writer| -> IoResult<()>) {
|
||||
let result = if Local::exists(None::<Task>) {
|
||||
let mut my_stdout = local_stdout.replace(None).unwrap_or_else(|| {
|
||||
box stdout() as Box<Writer:Send>
|
||||
box stdout() as Box<Writer + Send>
|
||||
});
|
||||
let result = f(my_stdout);
|
||||
local_stdout.replace(Some(my_stdout));
|
||||
|
@ -64,7 +64,7 @@ use rt::rtio::{IoFactory, LocalIo, RtioTimer, Callback};
|
||||
/// # }
|
||||
/// ```
|
||||
pub struct Timer {
|
||||
obj: Box<RtioTimer:Send>,
|
||||
obj: Box<RtioTimer + Send>,
|
||||
}
|
||||
|
||||
struct TimerCallback { tx: Sender<()> }
|
||||
|
@ -899,12 +899,6 @@ pub fn make_non_verbatim(path: &Path) -> Option<Path> {
|
||||
// \\?\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)))
|
||||
|
@ -63,9 +63,9 @@ pub struct TaskOpts {
|
||||
/// The size of the stack for the spawned task
|
||||
pub stack_size: Option<uint>,
|
||||
/// Task-local stdout
|
||||
pub stdout: Option<Box<Writer:Send>>,
|
||||
pub stdout: Option<Box<Writer + Send>>,
|
||||
/// Task-local stderr
|
||||
pub stderr: Option<Box<Writer:Send>>,
|
||||
pub stderr: Option<Box<Writer + Send>>,
|
||||
}
|
||||
|
||||
/**
|
||||
@ -83,7 +83,7 @@ pub struct TaskOpts {
|
||||
pub struct TaskBuilder {
|
||||
/// Options to spawn the new task with
|
||||
pub opts: TaskOpts,
|
||||
gen_body: Option<proc(v: proc():Send):Send -> proc():Send>,
|
||||
gen_body: Option<proc(v: proc(): Send): Send -> proc(): Send>,
|
||||
nocopy: marker::NoCopy,
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ impl 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 @@ impl TaskBuilder {
|
||||
* 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 @@ impl TaskBuilder {
|
||||
* # Failure
|
||||
* Fails if a future_result was already set for this task.
|
||||
*/
|
||||
pub fn try<T:Send>(mut self, f: proc():Send -> T)
|
||||
-> Result<T, Box<Any:Send>> {
|
||||
pub fn try<T: Send>(mut self, f: proc(): Send -> T)
|
||||
-> Result<T, Box<Any + Send>> {
|
||||
let (tx, rx) = channel();
|
||||
|
||||
let result = self.future_result();
|
||||
@ -247,7 +247,7 @@ impl 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<T:Send>(f: proc():Send -> T) -> Result<T, Box<Any:Send>> {
|
||||
pub fn try<T: Send>(f: proc(): Send -> T) -> Result<T, Box<Any + Send>> {
|
||||
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::<uint>();
|
||||
|
||||
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<Any:Send>);
|
||||
fail!(box 413u16 as Box<Any + Send>);
|
||||
}) {
|
||||
Err(e) => {
|
||||
type T = Box<Any:Send>;
|
||||
type T = Box<Any + Send>;
|
||||
assert!(e.is::<T>());
|
||||
let any = e.move::<T>().unwrap();
|
||||
assert!(any.is::<u16>());
|
||||
|
@ -828,7 +828,7 @@ mod tests {
|
||||
let m = Arc::new(Mutex::new());
|
||||
let m2 = m.clone();
|
||||
|
||||
let result: result::Result<(), Box<Any:Send>> = task::try(proc() {
|
||||
let result: result::Result<(), Box<Any + Send>> = task::try(proc() {
|
||||
let _lock = m2.lock();
|
||||
fail!();
|
||||
});
|
||||
@ -1068,7 +1068,7 @@ mod tests {
|
||||
let x = Arc::new(RWLock::new());
|
||||
let x2 = x.clone();
|
||||
|
||||
let result: result::Result<(), Box<Any:Send>> = task::try(proc() {
|
||||
let result: result::Result<(), Box<Any + Send>> = task::try(proc() {
|
||||
lock_rwlock_in_mode(&x2, mode1, || {
|
||||
fail!();
|
||||
})
|
||||
|
@ -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 {
|
||||
|
@ -118,7 +118,7 @@ impl SpanHandler {
|
||||
// others log errors for later reporting.
|
||||
pub struct Handler {
|
||||
err_count: Cell<uint>,
|
||||
emit: RefCell<Box<Emitter:Send>>,
|
||||
emit: RefCell<Box<Emitter + Send>>,
|
||||
}
|
||||
|
||||
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<Emitter:Send>) -> Handler {
|
||||
pub fn mk_handler(e: Box<Emitter + Send>) -> Handler {
|
||||
Handler {
|
||||
err_count: Cell::new(0),
|
||||
emit: RefCell::new(e),
|
||||
@ -281,8 +281,8 @@ pub struct EmitterWriter {
|
||||
}
|
||||
|
||||
enum Destination {
|
||||
Terminal(Box<term::Terminal<Box<Writer:Send>>:Send>),
|
||||
Raw(Box<Writer:Send>),
|
||||
Terminal(Box<term::Terminal<Box<Writer + Send>> + Send>),
|
||||
Raw(Box<Writer + Send>),
|
||||
}
|
||||
|
||||
impl EmitterWriter {
|
||||
@ -306,7 +306,7 @@ impl EmitterWriter {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(dst: Box<Writer:Send>) -> EmitterWriter {
|
||||
pub fn new(dst: Box<Writer + Send>) -> EmitterWriter {
|
||||
EmitterWriter { dst: Raw(dst) }
|
||||
}
|
||||
}
|
||||
|
@ -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 &&
|
||||
|
@ -257,13 +257,13 @@ pub enum SyntaxExtension {
|
||||
/// A normal, function-like syntax extension.
|
||||
///
|
||||
/// `bytes!` is a `NormalTT`.
|
||||
NormalTT(Box<MacroExpander:'static>, Option<Span>),
|
||||
NormalTT(Box<MacroExpander + 'static>, Option<Span>),
|
||||
|
||||
/// A function-like syntax extension that has an extra ident before
|
||||
/// the block.
|
||||
///
|
||||
/// `macro_rules!` is an `IdentTT`.
|
||||
IdentTT(Box<IdentMacroExpander:'static>, Option<Span>),
|
||||
IdentTT(Box<IdentMacroExpander + 'static>, Option<Span>),
|
||||
}
|
||||
|
||||
pub type NamedSyntaxExtension = (Name, SyntaxExtension);
|
||||
|
@ -90,13 +90,6 @@ impl<'a> ParserAttr for Parser<'a> {
|
||||
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 `{}`",
|
||||
|
@ -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<Reader:>,
|
||||
pub reader: Box<Reader>,
|
||||
pub interner: Rc<token::IdentInterner>,
|
||||
/// 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<Reader:>) -> Parser<'a> {
|
||||
pub fn new(sess: &'a ParseSess, cfg: ast::CrateConfig,
|
||||
mut rdr: Box<Reader>) -> Parser<'a> {
|
||||
let tok0 = rdr.next_token();
|
||||
let span = tok0.sp;
|
||||
let placeholder = TokenAndSpan {
|
||||
@ -1232,13 +1233,6 @@ impl<'a> Parser<'a> {
|
||||
})
|
||||
}
|
||||
|
||||
#[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 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
|
||||
// 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 @@ impl<'a> Parser<'a> {
|
||||
// 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 @@ impl<'a> Parser<'a> {
|
||||
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();
|
||||
|
@ -68,25 +68,25 @@ mod win;
|
||||
#[cfg(not(windows))]
|
||||
/// Return a Terminal wrapping stdout, or None if a terminal couldn't be
|
||||
/// opened.
|
||||
pub fn stdout() -> Option<Box<Terminal<Box<Writer:Send>>:Send>> {
|
||||
let ti: Option<TerminfoTerminal<Box<Writer:Send>>>
|
||||
= Terminal::new(box std::io::stdout() as Box<Writer:Send>);
|
||||
ti.map(|t| box t as Box<Terminal<Box<Writer:Send>:Send>:Send>)
|
||||
pub fn stdout() -> Option<Box<Terminal<Box<Writer + Send>> + Send>> {
|
||||
let ti: Option<TerminfoTerminal<Box<Writer + Send>>>
|
||||
= Terminal::new(box std::io::stdout() as Box<Writer + Send>);
|
||||
ti.map(|t| box t as Box<Terminal<Box<Writer + Send> + Send> + Send>)
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
/// Return a Terminal wrapping stdout, or None if a terminal couldn't be
|
||||
/// opened.
|
||||
pub fn stdout() -> Option<Box<Terminal<Box<Writer:Send>:Send>:Send>> {
|
||||
let ti: Option<TerminfoTerminal<Box<Writer:Send>>>
|
||||
= Terminal::new(box std::io::stdout() as Box<Writer:Send>);
|
||||
pub fn stdout() -> Option<Box<Terminal<Box<Writer + Send> + Send> + Send>> {
|
||||
let ti: Option<TerminfoTerminal<Box<Writer + Send>>>
|
||||
= Terminal::new(box std::io::stdout() as Box<Writer + Send>);
|
||||
|
||||
match ti {
|
||||
Some(t) => Some(box t as Box<Terminal<Box<Writer:Send>:Send>:Send>),
|
||||
Some(t) => Some(box t as Box<Terminal<Box<Writer + Send> + Send> + Send>),
|
||||
None => {
|
||||
let wc: Option<WinConsole<Box<Writer:Send>>>
|
||||
= Terminal::new(box std::io::stdout() as Box<Writer:Send>);
|
||||
wc.map(|w| box w as Box<Terminal<Box<Writer:Send>:Send>:Send>)
|
||||
let wc: Option<WinConsole<Box<Writer + Send>>>
|
||||
= Terminal::new(box std::io::stdout() as Box<Writer + Send>);
|
||||
wc.map(|w| box w as Box<Terminal<Box<Writer + Send> + Send> + Send>)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,25 +94,25 @@ pub fn stdout() -> Option<Box<Terminal<Box<Writer:Send>:Send>:Send>> {
|
||||
#[cfg(not(windows))]
|
||||
/// Return a Terminal wrapping stderr, or None if a terminal couldn't be
|
||||
/// opened.
|
||||
pub fn stderr() -> Option<Box<Terminal<Box<Writer:Send>:Send>:Send>:Send> {
|
||||
let ti: Option<TerminfoTerminal<Box<Writer:Send>>>
|
||||
= Terminal::new(box std::io::stderr() as Box<Writer:Send>);
|
||||
ti.map(|t| box t as Box<Terminal<Box<Writer:Send>:Send>:Send>)
|
||||
pub fn stderr() -> Option<Box<Terminal<Box<Writer + Send> + Send> + Send> + Send> {
|
||||
let ti: Option<TerminfoTerminal<Box<Writer + Send>>>
|
||||
= Terminal::new(box std::io::stderr() as Box<Writer + Send>);
|
||||
ti.map(|t| box t as Box<Terminal<Box<Writer + Send> + Send> + Send>)
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
/// Return a Terminal wrapping stderr, or None if a terminal couldn't be
|
||||
/// opened.
|
||||
pub fn stderr() -> Option<Box<Terminal<Box<Writer:Send>:Send>:Send>> {
|
||||
let ti: Option<TerminfoTerminal<Box<Writer:Send>>>
|
||||
= Terminal::new(box std::io::stderr() as Box<Writer:Send>);
|
||||
pub fn stderr() -> Option<Box<Terminal<Box<Writer + Send> + Send> + Send>> {
|
||||
let ti: Option<TerminfoTerminal<Box<Writer + Send>>>
|
||||
= Terminal::new(box std::io::stderr() as Box<Writer + Send>);
|
||||
|
||||
match ti {
|
||||
Some(t) => Some(box t as Box<Terminal<Box<Writer:Send>:Send>:Send>),
|
||||
Some(t) => Some(box t as Box<Terminal<Box<Writer + Send> + Send> + Send>),
|
||||
None => {
|
||||
let wc: Option<WinConsole<Box<Writer:Send>>>
|
||||
= Terminal::new(box std::io::stderr() as Box<Writer:Send>);
|
||||
wc.map(|w| box w as Box<Terminal<Box<Writer:Send>:Send>:Send>)
|
||||
let wc: Option<WinConsole<Box<Writer + Send>>>
|
||||
= Terminal::new(box std::io::stderr() as Box<Writer + Send>);
|
||||
wc.map(|w| box w as Box<Terminal<Box<Writer + Send> + Send> + Send>)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -346,16 +346,16 @@ environment variable. Logging is not captured by default.
|
||||
|
||||
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<T> {
|
||||
Pretty(Box<term::Terminal<Box<Writer:Send>>:Send>),
|
||||
Pretty(Box<term::Terminal<Box<Writer + Send>> + Send>),
|
||||
Raw(T),
|
||||
}
|
||||
|
||||
@ -1049,8 +1049,8 @@ pub fn run_test(opts: &TestOpts,
|
||||
if nocapture {
|
||||
drop((stdout, stderr));
|
||||
} else {
|
||||
task.opts.stdout = Some(box stdout as Box<Writer:Send>);
|
||||
task.opts.stderr = Some(box stderr as Box<Writer:Send>);
|
||||
task.opts.stdout = Some(box stdout as Box<Writer + Send>);
|
||||
task.opts.stderr = Some(box stderr as Box<Writer + Send>);
|
||||
}
|
||||
let result_future = task.future_result();
|
||||
task.spawn(testfn);
|
||||
|
@ -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
|
||||
|
@ -27,7 +27,7 @@ impl Foo for B {
|
||||
}
|
||||
|
||||
struct A {
|
||||
v: Box<Foo:Send>,
|
||||
v: Box<Foo + Send>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -15,8 +15,8 @@ impl<A:Clone> Repeat<A> for A {
|
||||
fn get(&self) -> A { self.clone() }
|
||||
}
|
||||
|
||||
fn repeater<A:Clone>(v: A) -> Box<Repeat<A>:> {
|
||||
box v as Box<Repeat<A>:> // No
|
||||
fn repeater<A:Clone>(v: A) -> Box<Repeat<A>> {
|
||||
box v as Box<Repeat<A>> // No
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -15,16 +15,16 @@ struct B<'a, T>(&'a A<T>);
|
||||
trait X {}
|
||||
impl<'a, T> X for B<'a, T> {}
|
||||
|
||||
fn f<'a, T, U>(v: Box<A<T>>) -> Box<X:> {
|
||||
box B(v) as Box<X:> //~ ERROR value may contain references; add `'static` bound to `T`
|
||||
fn f<'a, T, U>(v: Box<A<T>>) -> Box<X> {
|
||||
box B(v) as Box<X> //~ ERROR value may contain references; add `'static` bound to `T`
|
||||
}
|
||||
|
||||
fn g<'a, T, U>(v: Box<A<U>>) -> Box<X:> {
|
||||
box B(v) as Box<X:> //~ ERROR value may contain references; add `'static` bound to `U`
|
||||
fn g<'a, T, U>(v: Box<A<U>>) -> Box<X> {
|
||||
box B(v) as Box<X> //~ ERROR value may contain references; add `'static` bound to `U`
|
||||
}
|
||||
|
||||
fn h<'a, T: 'static>(v: Box<A<T>>) -> Box<X:> {
|
||||
box B(v) as Box<X:> // ok
|
||||
fn h<'a, T: 'static>(v: Box<A<T>>) -> Box<X> {
|
||||
box B(v) as Box<X> // ok
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
trait Foo { }
|
||||
|
||||
fn foo<'a>(x: Box<Foo:'a>) { //~ ERROR only the 'static lifetime is accepted here
|
||||
fn foo<'a>(x: Box<Foo + 'a>) { //~ ERROR only the 'static lifetime is accepted here
|
||||
}
|
||||
|
||||
fn bar<'a, T:'a>() { //~ ERROR only the 'static lifetime is accepted here
|
||||
|
@ -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<Foo>` or `&Foo`
|
||||
}
|
||||
|
||||
|
@ -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() { }
|
||||
|
@ -11,6 +11,6 @@
|
||||
|
||||
struct Foo;
|
||||
|
||||
fn foo(_x: Box<Foo:Send>) { } //~ ERROR kind bounds can only be used on trait types
|
||||
fn foo(_x: Box<Foo + Send>) { } //~ ERROR kind bounds can only be used on trait types
|
||||
|
||||
fn main() { }
|
||||
|
@ -29,11 +29,11 @@ impl<A:Clone> Invokable<A> for Invoker<A> {
|
||||
}
|
||||
}
|
||||
|
||||
fn f<A:Clone + 'static>(a: A, b: u16) -> Box<Invokable<A>:> {
|
||||
fn f<A:Clone + 'static>(a: A, b: u16) -> Box<Invokable<A>> {
|
||||
box Invoker {
|
||||
a: a,
|
||||
b: b,
|
||||
} as (Box<Invokable<A>>+)
|
||||
} as (Box<Invokable<A>>)
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
@ -12,8 +12,8 @@
|
||||
trait hax { }
|
||||
impl<A> hax for A { }
|
||||
|
||||
fn perform_hax<T: 'static>(x: Box<T>) -> Box<hax:> {
|
||||
box x as Box<hax:>
|
||||
fn perform_hax<T: 'static>(x: Box<T>) -> Box<hax> {
|
||||
box x as Box<hax>
|
||||
}
|
||||
|
||||
fn deadcode() {
|
||||
|
@ -12,8 +12,8 @@
|
||||
trait hax { }
|
||||
impl<A> hax for A { }
|
||||
|
||||
fn perform_hax<T: 'static>(x: Box<T>) -> Box<hax:> {
|
||||
box x as Box<hax:>
|
||||
fn perform_hax<T: 'static>(x: Box<T>) -> Box<hax> {
|
||||
box x as Box<hax>
|
||||
}
|
||||
|
||||
fn deadcode() {
|
||||
|
@ -20,6 +20,6 @@ pub fn main() {}
|
||||
trait A {}
|
||||
impl<T: 'static> A for T {}
|
||||
|
||||
fn owned1<T: 'static>(a: T) { box a as Box<A:>; } /* note `:` */
|
||||
fn owned2<T: 'static>(a: Box<T>) { a as Box<A:>; }
|
||||
fn owned3<T: 'static>(a: Box<T>) { box a as Box<A:>; }
|
||||
fn owned1<T: 'static>(a: T) { box a as Box<A+>; } /* note `:` */
|
||||
fn owned2<T: 'static>(a: Box<T>) { a as Box<A>; }
|
||||
fn owned3<T: 'static>(a: Box<T>) { box a as Box<A>; }
|
||||
|
@ -17,9 +17,9 @@ impl<A:Clone + 'static> repeat<A> for Box<A> {
|
||||
}
|
||||
}
|
||||
|
||||
fn repeater<A:Clone + 'static>(v: Box<A>) -> Box<repeat<A>:> {
|
||||
fn repeater<A:Clone + 'static>(v: Box<A>) -> Box<repeat<A>> {
|
||||
// Note: owned kind is not necessary as A appears in the trait type
|
||||
box v as Box<repeat<A>:> // No
|
||||
box v as Box<repeat<A>> // No
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
@ -31,10 +31,10 @@ impl FooTrait for BarStruct {
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let foos: Vec<Box<FooTrait:>> = vec!(
|
||||
box BarStruct{ x: box(GC) 0 } as Box<FooTrait:>,
|
||||
box BarStruct{ x: box(GC) 1 } as Box<FooTrait:>,
|
||||
box BarStruct{ x: box(GC) 2 } as Box<FooTrait:>
|
||||
let foos: Vec<Box<FooTrait>> = vec!(
|
||||
box BarStruct{ x: box(GC) 0 } as Box<FooTrait>,
|
||||
box BarStruct{ x: box(GC) 1 } as Box<FooTrait>,
|
||||
box BarStruct{ x: box(GC) 2 } as Box<FooTrait>
|
||||
);
|
||||
|
||||
for i in range(0u, foos.len()) {
|
||||
|
@ -28,6 +28,6 @@ impl FooTrait for BarStruct {
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let foo = box BarStruct{ x: 22 } as Box<FooTrait:>;
|
||||
let foo = box BarStruct{ x: 22 } as Box<FooTrait>;
|
||||
assert_eq!(22, foo.foo());
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ mod foo {
|
||||
pub trait D<'a, T> {}
|
||||
}
|
||||
|
||||
fn foo1<T>(_: &A<T>: Send) {}
|
||||
fn foo2<T>(_: Box<A<T>: Send + Share>) {}
|
||||
fn foo3<T>(_: Box<B<int, uint>: 'static>) {}
|
||||
fn foo4<'a, T>(_: Box<C<'a, T>: 'static + Send>) {}
|
||||
fn foo5<'a, T>(_: Box<foo::D<'a, T>: 'static + Send>) {}
|
||||
fn foo1<T>(_: &A<T> + Send) {}
|
||||
fn foo2<T>(_: Box<A<T> + Send + Share>) {}
|
||||
fn foo3<T>(_: Box<B<int, uint> + 'static>) {}
|
||||
fn foo4<'a, T>(_: Box<C<'a, T> + 'static + Send>) {}
|
||||
fn foo5<'a, T>(_: Box<foo::D<'a, T> + 'static + Send>) {}
|
||||
|
||||
pub fn main() {}
|
||||
|
@ -15,10 +15,10 @@
|
||||
|
||||
trait Foo { }
|
||||
|
||||
fn foo<'a>(x: Box<Foo:'a>) {
|
||||
fn foo<'a>(x: Box<Foo + 'a>) {
|
||||
}
|
||||
|
||||
fn bar<'a, T:'a>() {
|
||||
fn bar<'a, T: 'a>() {
|
||||
}
|
||||
|
||||
pub fn main() { }
|
||||
|
Loading…
x
Reference in New Issue
Block a user