Skip to content

Commit 7ec7805

Browse files
committed
auto merge of #14900 : alexcrichton/rust/snapshots, r=huonw
Closes #14898 Closes #14918
2 parents 2ef910f + 89b0e6e commit 7ec7805

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+321
-841
lines changed

src/doc/tutorial.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2518,8 +2518,8 @@ valid types:
25182518
trait Foo {}
25192519
trait Bar<T> {}
25202520

2521-
fn sendable_foo(f: Box<Foo:Send>) { /* ... */ }
2522-
fn shareable_bar<T: Share>(b: &Bar<T>: Share) { /* ... */ }
2521+
fn sendable_foo(f: Box<Foo + Send>) { /* ... */ }
2522+
fn shareable_bar<T: Share>(b: &Bar<T> + Share) { /* ... */ }
25232523
~~~
25242524

25252525
When no colon is specified (such as the type `~Foo`), it is inferred that the

src/libcollections/bitv.rs

-14
Original file line numberDiff line numberDiff line change
@@ -842,20 +842,6 @@ impl cmp::PartialEq for BitvSet {
842842
}
843843

844844
impl fmt::Show for BitvSet {
845-
#[cfg(stage0)]
846-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
847-
try!(write!(fmt, r"\{"));
848-
let mut first = true;
849-
for n in self.iter() {
850-
if !first {
851-
try!(write!(fmt, ", "));
852-
}
853-
try!(write!(fmt, "{}", n));
854-
first = false;
855-
}
856-
write!(fmt, r"\}")
857-
}
858-
#[cfg(not(stage0))]
859845
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
860846
try!(write!(fmt, "{{"));
861847
let mut first = true;

src/libcollections/smallintmap.rs

-12
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,6 @@ impl<V:Clone> SmallIntMap<V> {
185185
}
186186

187187
impl<V: fmt::Show> fmt::Show for SmallIntMap<V> {
188-
#[cfg(stage0)]
189-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
190-
try!(write!(f, r"\{"));
191-
192-
for (i, (k, v)) in self.iter().enumerate() {
193-
if i != 0 { try!(write!(f, ", ")); }
194-
try!(write!(f, "{}: {}", k, *v));
195-
}
196-
197-
write!(f, r"\}")
198-
}
199-
#[cfg(not(stage0))]
200188
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
201189
try!(write!(f, "{{"));
202190

src/libcollections/treemap.rs

-24
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,6 @@ impl<K: PartialOrd + Ord, V: PartialOrd> PartialOrd for TreeMap<K, V> {
7676
}
7777

7878
impl<K: Ord + Show, V: Show> Show for TreeMap<K, V> {
79-
#[cfg(stage0)]
80-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
81-
try!(write!(f, r"\{"));
82-
83-
for (i, (k, v)) in self.iter().enumerate() {
84-
if i != 0 { try!(write!(f, ", ")); }
85-
try!(write!(f, "{}: {}", *k, *v));
86-
}
87-
88-
write!(f, r"\}")
89-
}
90-
#[cfg(not(stage0))]
9179
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
9280
try!(write!(f, "{{"));
9381

@@ -586,18 +574,6 @@ impl<T: PartialOrd + Ord> PartialOrd for TreeSet<T> {
586574
}
587575

588576
impl<T: Ord + Show> Show for TreeSet<T> {
589-
#[cfg(stage0)]
590-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
591-
try!(write!(f, r"\{"));
592-
593-
for (i, x) in self.iter().enumerate() {
594-
if i != 0 { try!(write!(f, ", ")); }
595-
try!(write!(f, "{}", *x));
596-
}
597-
598-
write!(f, r"\}")
599-
}
600-
#[cfg(not(stage0))]
601577
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
602578
try!(write!(f, "{{"));
603579

src/libcore/fmt/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -744,11 +744,6 @@ impl Show for () {
744744
}
745745

746746
impl<T: Copy + Show> Show for Cell<T> {
747-
#[cfg(stage0)]
748-
fn fmt(&self, f: &mut Formatter) -> Result {
749-
write!(f, r"Cell \{ value: {} \}", self.get())
750-
}
751-
#[cfg(not(stage0))]
752747
fn fmt(&self, f: &mut Formatter) -> Result {
753748
write!(f, "Cell {{ value: {} }}", self.get())
754749
}

src/libcore/fmt/rt.rs

-5
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
//! these can be statically allocated and are slightly optimized for the runtime
1616
1717

18-
#[cfg(stage0)]
19-
use option::Option;
20-
2118
#[doc(hidden)]
2219
pub enum Piece<'a> {
2320
String(&'a str),
@@ -28,8 +25,6 @@ pub enum Piece<'a> {
2825
pub struct Argument<'a> {
2926
pub position: Position,
3027
pub format: FormatSpec,
31-
#[cfg(stage0)]
32-
pub method: Option<uint>,
3328
}
3429

3530
#[doc(hidden)]

src/libcore/intrinsics.rs

-8
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ pub trait TyVisitor {
100100

101101
fn visit_char(&mut self) -> bool;
102102

103-
#[cfg(stage0)]
104-
fn visit_estr_box(&mut self) -> bool;
105-
#[cfg(stage0)]
106-
fn visit_estr_uniq(&mut self) -> bool;
107103
fn visit_estr_slice(&mut self) -> bool;
108104
fn visit_estr_fixed(&mut self, n: uint, sz: uint, align: uint) -> bool;
109105

@@ -112,10 +108,6 @@ pub trait TyVisitor {
112108
fn visit_ptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
113109
fn visit_rptr(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
114110

115-
#[cfg(stage0)]
116-
fn visit_evec_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
117-
#[cfg(stage0)]
118-
fn visit_evec_uniq(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
119111
fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool;
120112
fn visit_evec_fixed(&mut self, n: uint, sz: uint, align: uint,
121113
mtbl: uint, inner: *TyDesc) -> bool;

src/libdebug/reflect.rs

-20
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,6 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
193193
true
194194
}
195195

196-
#[cfg(stage0)]
197-
fn visit_estr_box(&mut self) -> bool {
198-
true
199-
}
200-
201-
#[cfg(stage0)]
202-
fn visit_estr_uniq(&mut self) -> bool {
203-
false
204-
}
205-
206196
fn visit_estr_slice(&mut self) -> bool {
207197
self.align_to::<&'static str>();
208198
if ! self.inner.visit_estr_slice() { return false; }
@@ -247,16 +237,6 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
247237
true
248238
}
249239

250-
#[cfg(stage0)]
251-
fn visit_evec_box(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool {
252-
true
253-
}
254-
255-
#[cfg(stage0)]
256-
fn visit_evec_uniq(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool {
257-
false
258-
}
259-
260240
fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
261241
self.align_to::<&'static [u8]>();
262242
if ! self.inner.visit_evec_slice(mtbl, inner) { return false; }

src/libdebug/repr.rs

-20
Original file line numberDiff line numberDiff line change
@@ -269,16 +269,6 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
269269
})
270270
}
271271

272-
#[cfg(stage0)]
273-
fn visit_estr_box(&mut self) -> bool {
274-
false
275-
}
276-
277-
#[cfg(stage0)]
278-
fn visit_estr_uniq(&mut self) -> bool {
279-
false
280-
}
281-
282272
fn visit_estr_slice(&mut self) -> bool {
283273
self.get::<&str>(|this, s| this.write_escaped_slice(*s))
284274
}
@@ -320,16 +310,6 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
320310
})
321311
}
322312

323-
#[cfg(stage0)]
324-
fn visit_evec_box(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool {
325-
true
326-
}
327-
328-
#[cfg(stage0)]
329-
fn visit_evec_uniq(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool {
330-
true
331-
}
332-
333313
fn visit_evec_slice(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
334314
self.get::<raw::Slice<()>>(|this, s| {
335315
try!(this, this.writer.write(['&' as u8]));

src/libgreen/basic.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ use std::rt::rtio::{PausableIdleCallback, Callback};
2323
use std::rt::exclusive::Exclusive;
2424

2525
/// This is the only exported function from this module.
26-
pub fn event_loop() -> Box<EventLoop:Send> {
27-
box BasicLoop::new() as Box<EventLoop:Send>
26+
pub fn event_loop() -> Box<EventLoop + Send> {
27+
box BasicLoop::new() as Box<EventLoop + Send>
2828
}
2929

3030
struct BasicLoop {
31-
work: Vec<proc():Send>, // pending work
32-
remotes: Vec<(uint, Box<Callback:Send>)>,
31+
work: Vec<proc(): Send>, // pending work
32+
remotes: Vec<(uint, Box<Callback + Send>)>,
3333
next_remote: uint,
3434
messages: Arc<Exclusive<Vec<Message>>>,
35-
idle: Option<Box<Callback:Send>>,
35+
idle: Option<Box<Callback + Send>>,
3636
idle_active: Option<Arc<atomics::AtomicBool>>,
3737
}
3838

@@ -132,22 +132,22 @@ impl EventLoop for BasicLoop {
132132
}
133133

134134
// FIXME: Seems like a really weird requirement to have an event loop provide.
135-
fn pausable_idle_callback(&mut self, cb: Box<Callback:Send>)
136-
-> Box<PausableIdleCallback:Send> {
135+
fn pausable_idle_callback(&mut self, cb: Box<Callback + Send>)
136+
-> Box<PausableIdleCallback + Send> {
137137
rtassert!(self.idle.is_none());
138138
self.idle = Some(cb);
139139
let a = Arc::new(atomics::AtomicBool::new(true));
140140
self.idle_active = Some(a.clone());
141-
box BasicPausable { active: a } as Box<PausableIdleCallback:Send>
141+
box BasicPausable { active: a } as Box<PausableIdleCallback + Send>
142142
}
143143

144-
fn remote_callback(&mut self, f: Box<Callback:Send>)
145-
-> Box<RemoteCallback:Send> {
144+
fn remote_callback(&mut self, f: Box<Callback + Send>)
145+
-> Box<RemoteCallback + Send> {
146146
let id = self.next_remote;
147147
self.next_remote += 1;
148148
self.remotes.push((id, f));
149149
box BasicRemote::new(self.messages.clone(), id) as
150-
Box<RemoteCallback:Send>
150+
Box<RemoteCallback + Send>
151151
}
152152

153153
fn io<'a>(&'a mut self) -> Option<&'a mut IoFactory> { None }

src/libgreen/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ macro_rules! green_start( ($f:ident) => (
288288
/// The return value is used as the process return code. 0 on success, 101 on
289289
/// error.
290290
pub fn start(argc: int, argv: **u8,
291-
event_loop_factory: fn() -> Box<rtio::EventLoop:Send>,
291+
event_loop_factory: fn() -> Box<rtio::EventLoop + Send>,
292292
main: proc():Send) -> int {
293293
rt::init(argc, argv);
294294
let mut main = Some(main);
@@ -309,7 +309,7 @@ pub fn start(argc: int, argv: **u8,
309309
///
310310
/// This function will not return until all schedulers in the associated pool
311311
/// have returned.
312-
pub fn run(event_loop_factory: fn() -> Box<rtio::EventLoop:Send>,
312+
pub fn run(event_loop_factory: fn() -> Box<rtio::EventLoop + Send>,
313313
main: proc():Send) -> int {
314314
// Create a scheduler pool and spawn the main task into this pool. We will
315315
// get notified over a channel when the main task exits.
@@ -340,7 +340,7 @@ pub struct PoolConfig {
340340
pub threads: uint,
341341
/// A factory function used to create new event loops. If this is not
342342
/// specified then the default event loop factory is used.
343-
pub event_loop_factory: fn() -> Box<rtio::EventLoop:Send>,
343+
pub event_loop_factory: fn() -> Box<rtio::EventLoop + Send>,
344344
}
345345

346346
impl PoolConfig {
@@ -365,7 +365,7 @@ pub struct SchedPool {
365365
stack_pool: StackPool,
366366
deque_pool: deque::BufferPool<Box<task::GreenTask>>,
367367
sleepers: SleeperList,
368-
factory: fn() -> Box<rtio::EventLoop:Send>,
368+
factory: fn() -> Box<rtio::EventLoop + Send>,
369369
task_state: TaskState,
370370
tasks_done: Receiver<()>,
371371
}

src/libgreen/sched.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub struct Scheduler {
8383
/// A fast XorShift rng for scheduler use
8484
rng: XorShiftRng,
8585
/// A toggleable idle callback
86-
idle_callback: Option<Box<PausableIdleCallback:Send>>,
86+
idle_callback: Option<Box<PausableIdleCallback + Send>>,
8787
/// A countdown that starts at a random value and is decremented
8888
/// every time a yield check is performed. When it hits 0 a task
8989
/// will yield.
@@ -100,7 +100,7 @@ pub struct Scheduler {
100100
// destroyed before it's actually destroyed.
101101

102102
/// The event loop used to drive the scheduler and perform I/O
103-
pub event_loop: Box<EventLoop:Send>,
103+
pub event_loop: Box<EventLoop + Send>,
104104
}
105105

106106
/// An indication of how hard to work on a given operation, the difference
@@ -123,7 +123,7 @@ impl Scheduler {
123123
// * Initialization Functions
124124

125125
pub fn new(pool_id: uint,
126-
event_loop: Box<EventLoop:Send>,
126+
event_loop: Box<EventLoop + Send>,
127127
work_queue: deque::Worker<Box<GreenTask>>,
128128
work_queues: Vec<deque::Stealer<Box<GreenTask>>>,
129129
sleeper_list: SleeperList,
@@ -136,7 +136,7 @@ impl Scheduler {
136136
}
137137

138138
pub fn new_special(pool_id: uint,
139-
event_loop: Box<EventLoop:Send>,
139+
event_loop: Box<EventLoop + Send>,
140140
work_queue: deque::Worker<Box<GreenTask>>,
141141
work_queues: Vec<deque::Stealer<Box<GreenTask>>>,
142142
sleeper_list: SleeperList,
@@ -183,7 +183,7 @@ impl Scheduler {
183183
pub fn bootstrap(mut ~self) {
184184

185185
// Build an Idle callback.
186-
let cb = box SchedRunner as Box<Callback:Send>;
186+
let cb = box SchedRunner as Box<Callback + Send>;
187187
self.idle_callback = Some(self.event_loop.pausable_idle_callback(cb));
188188

189189
// Create a task for the scheduler with an empty context.
@@ -231,7 +231,7 @@ impl Scheduler {
231231
// mutable reference to the event_loop to give it the "run"
232232
// command.
233233
unsafe {
234-
let event_loop: *mut Box<EventLoop:Send> = &mut self.event_loop;
234+
let event_loop: *mut Box<EventLoop + Send> = &mut self.event_loop;
235235
// Our scheduler must be in the task before the event loop
236236
// is started.
237237
stask.put_with_sched(self);
@@ -904,7 +904,7 @@ pub enum SchedMessage {
904904
}
905905

906906
pub struct SchedHandle {
907-
remote: Box<RemoteCallback:Send>,
907+
remote: Box<RemoteCallback + Send>,
908908
queue: msgq::Producer<SchedMessage>,
909909
pub sched_id: uint
910910
}

src/liblog/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ pub static WARN: u32 = 2;
155155
/// Error log level
156156
pub static ERROR: u32 = 1;
157157

158-
local_data_key!(local_logger: Box<Logger:Send>)
158+
local_data_key!(local_logger: Box<Logger + Send>)
159159

160160
/// A trait used to represent an interface to a task-local logger. Each task
161161
/// 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) {
226226
// frob the slot while we're doing the logging. This will destroy any logger
227227
// set during logging.
228228
let mut logger = local_logger.replace(None).unwrap_or_else(|| {
229-
box DefaultLogger { handle: io::stderr() } as Box<Logger:Send>
229+
box DefaultLogger { handle: io::stderr() } as Box<Logger + Send>
230230
});
231231
logger.log(&LogRecord {
232232
level: LogLevel(level),
@@ -246,7 +246,7 @@ pub fn log_level() -> u32 { unsafe { LOG_LEVEL } }
246246

247247
/// Replaces the task-local logger with the specified logger, returning the old
248248
/// logger.
249-
pub fn set_logger(logger: Box<Logger:Send>) -> Option<Box<Logger:Send>> {
249+
pub fn set_logger(logger: Box<Logger + Send>) -> Option<Box<Logger + Send>> {
250250
local_logger.replace(Some(logger))
251251
}
252252

src/libnative/io/file_unix.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ impl rtio::RtioPipe for FileDesc {
168168
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
169169
self.inner_write(buf)
170170
}
171-
fn clone(&self) -> Box<rtio::RtioPipe:Send> {
172-
box FileDesc { inner: self.inner.clone() } as Box<rtio::RtioPipe:Send>
171+
fn clone(&self) -> Box<rtio::RtioPipe + Send> {
172+
box FileDesc { inner: self.inner.clone() } as Box<rtio::RtioPipe + Send>
173173
}
174174

175175
// Only supported on named pipes currently. Note that this doesn't have an

0 commit comments

Comments
 (0)