Skip to content

Commit e6b28f9

Browse files
committed
auto merge of #15797 : brson/rust/taskstab, r=alexcrichton
Summary: * alloc::rc module stable * Rc type stable * Functions relating to weak references experimental * core::cmp module stable * PartialEq/Eq/PartialOrd/Ord unstable because trait reform will make them change again * Equiv experimental because there may be better sol'ns * lexical_ordering deprecated because it can be done trivially with the Ord trait * min/max stable * std::task module stable * TaskBuilder::stdout/stderr experimental because we aren't certain we want to configure the environment this way * try_future experimental because Future is experimental * try unstable because the error type might change * deschedule/failing unstable The major thing I did differently than previously-discussed is that I made `try` experimental: there's been discussion that the error type `Box<Any + Send>` is not sufficient. Per https://github.com/rust-lang/meeting-minutes/blob/master/Meeting-API-review-2014-07-16.md.
2 parents 343a52f + 0b946f0 commit e6b28f9

File tree

4 files changed

+88
-23
lines changed

4 files changed

+88
-23
lines changed

src/liballoc/rc.rs

+18-1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ fn main() {
148148
149149
*/
150150

151+
#![stable]
152+
151153
use core::mem::transmute;
152154
use core::cell::Cell;
153155
use core::clone::Clone;
@@ -171,6 +173,7 @@ struct RcBox<T> {
171173

172174
/// Immutable reference counted pointer type
173175
#[unsafe_no_drop_flag]
176+
#[stable]
174177
pub struct Rc<T> {
175178
// FIXME #12808: strange names to try to avoid interfering with
176179
// field accesses of the contained type via Deref
@@ -179,6 +182,7 @@ pub struct Rc<T> {
179182
_noshare: marker::NoShare
180183
}
181184

185+
#[stable]
182186
impl<T> Rc<T> {
183187
/// Construct a new reference-counted box
184188
pub fn new(value: T) -> Rc<T> {
@@ -203,6 +207,7 @@ impl<T> Rc<T> {
203207

204208
impl<T> Rc<T> {
205209
/// Downgrade the reference-counted pointer to a weak reference
210+
#[experimental = "Weak pointers may not belong in this module."]
206211
pub fn downgrade(&self) -> Weak<T> {
207212
self.inc_weak();
208213
Weak {
@@ -238,6 +243,7 @@ impl<T: Clone> Rc<T> {
238243
}
239244
}
240245

246+
#[experimental = "Deref is experimental."]
241247
impl<T> Deref<T> for Rc<T> {
242248
/// Borrow the value contained in the reference-counted box
243249
#[inline(always)]
@@ -247,6 +253,7 @@ impl<T> Deref<T> for Rc<T> {
247253
}
248254

249255
#[unsafe_destructor]
256+
#[experimental = "Drop is experimental."]
250257
impl<T> Drop for Rc<T> {
251258
fn drop(&mut self) {
252259
unsafe {
@@ -269,7 +276,7 @@ impl<T> Drop for Rc<T> {
269276
}
270277
}
271278

272-
#[unstable]
279+
#[unstable = "Clone is unstable."]
273280
impl<T> Clone for Rc<T> {
274281
#[inline]
275282
fn clone(&self) -> Rc<T> {
@@ -278,22 +285,26 @@ impl<T> Clone for Rc<T> {
278285
}
279286
}
280287

288+
#[stable]
281289
impl<T: Default> Default for Rc<T> {
282290
#[inline]
283291
fn default() -> Rc<T> {
284292
Rc::new(Default::default())
285293
}
286294
}
287295

296+
#[unstable = "PartialEq is unstable."]
288297
impl<T: PartialEq> PartialEq for Rc<T> {
289298
#[inline(always)]
290299
fn eq(&self, other: &Rc<T>) -> bool { **self == **other }
291300
#[inline(always)]
292301
fn ne(&self, other: &Rc<T>) -> bool { **self != **other }
293302
}
294303

304+
#[unstable = "Eq is unstable."]
295305
impl<T: Eq> Eq for Rc<T> {}
296306

307+
#[unstable = "PartialOrd is unstable."]
297308
impl<T: PartialOrd> PartialOrd for Rc<T> {
298309
#[inline(always)]
299310
fn partial_cmp(&self, other: &Rc<T>) -> Option<Ordering> {
@@ -313,11 +324,13 @@ impl<T: PartialOrd> PartialOrd for Rc<T> {
313324
fn ge(&self, other: &Rc<T>) -> bool { **self >= **other }
314325
}
315326

327+
#[unstable = "Ord is unstable."]
316328
impl<T: Ord> Ord for Rc<T> {
317329
#[inline]
318330
fn cmp(&self, other: &Rc<T>) -> Ordering { (**self).cmp(&**other) }
319331
}
320332

333+
#[experimental = "Show is experimental."]
321334
impl<T: fmt::Show> fmt::Show for Rc<T> {
322335
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
323336
(**self).fmt(f)
@@ -326,6 +339,7 @@ impl<T: fmt::Show> fmt::Show for Rc<T> {
326339

327340
/// Weak reference to a reference-counted box
328341
#[unsafe_no_drop_flag]
342+
#[experimental = "Weak pointers may not belong in this module."]
329343
pub struct Weak<T> {
330344
// FIXME #12808: strange names to try to avoid interfering with
331345
// field accesses of the contained type via Deref
@@ -334,6 +348,7 @@ pub struct Weak<T> {
334348
_noshare: marker::NoShare
335349
}
336350

351+
#[experimental = "Weak pointers may not belong in this module."]
337352
impl<T> Weak<T> {
338353
/// Upgrade a weak reference to a strong reference
339354
pub fn upgrade(&self) -> Option<Rc<T>> {
@@ -347,6 +362,7 @@ impl<T> Weak<T> {
347362
}
348363

349364
#[unsafe_destructor]
365+
#[experimental = "Weak pointers may not belong in this module."]
350366
impl<T> Drop for Weak<T> {
351367
fn drop(&mut self) {
352368
unsafe {
@@ -364,6 +380,7 @@ impl<T> Drop for Weak<T> {
364380
}
365381

366382
#[unstable]
383+
#[experimental = "Weak pointers may not belong in this module."]
367384
impl<T> Clone for Weak<T> {
368385
#[inline]
369386
fn clone(&self) -> Weak<T> {

src/libcore/cmp.rs

+31
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
//! assert!(SketchyNum {num: 25} != SketchyNum {num: 57});
3838
//! ```
3939
40+
#![stable]
41+
4042
use option::{Option, Some};
4143

4244
/// Trait for values that can be compared for equality and inequality.
@@ -53,6 +55,7 @@ use option::{Option, Some};
5355
/// Eventually, this will be implemented by default for types that implement
5456
/// `Eq`.
5557
#[lang="eq"]
58+
#[unstable = "Definition may change slightly after trait reform"]
5659
pub trait PartialEq {
5760
/// This method tests for `self` and `other` values to be equal, and is used by `==`.
5861
fn eq(&self, other: &Self) -> bool;
@@ -71,6 +74,7 @@ pub trait PartialEq {
7174
/// - reflexive: `a == a`;
7275
/// - symmetric: `a == b` implies `b == a`; and
7376
/// - transitive: `a == b` and `b == c` implies `a == c`.
77+
#[unstable = "Definition may change slightly after trait reform"]
7478
pub trait Eq: PartialEq {
7579
// FIXME #13101: this method is used solely by #[deriving] to
7680
// assert that every component of a type implements #[deriving]
@@ -86,6 +90,7 @@ pub trait Eq: PartialEq {
8690

8791
/// An ordering is, e.g, a result of a comparison between two values.
8892
#[deriving(Clone, PartialEq, Show)]
93+
#[stable]
8994
pub enum Ordering {
9095
/// An ordering where a compared value is less [than another].
9196
Less = -1i,
@@ -104,6 +109,7 @@ pub enum Ordering {
104109
/// true; and
105110
/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for
106111
/// both `==` and `>`.
112+
#[unstable = "Definition may change slightly after trait reform"]
107113
pub trait Ord: Eq + PartialOrd {
108114
/// This method returns an ordering between `self` and `other` values.
109115
///
@@ -118,15 +124,18 @@ pub trait Ord: Eq + PartialOrd {
118124
fn cmp(&self, other: &Self) -> Ordering;
119125
}
120126

127+
#[unstable = "Trait is unstable."]
121128
impl Eq for Ordering {}
122129

130+
#[unstable = "Trait is unstable."]
123131
impl Ord for Ordering {
124132
#[inline]
125133
fn cmp(&self, other: &Ordering) -> Ordering {
126134
(*self as int).cmp(&(*other as int))
127135
}
128136
}
129137

138+
#[unstable = "Trait is unstable."]
130139
impl PartialOrd for Ordering {
131140
#[inline]
132141
fn partial_cmp(&self, other: &Ordering) -> Option<Ordering> {
@@ -140,6 +149,7 @@ impl PartialOrd for Ordering {
140149
/// If the first ordering is different, the first ordering is all that must be returned.
141150
/// If the first ordering is equal, then second ordering is returned.
142151
#[inline]
152+
#[deprecated = "Just call .cmp() on an Ordering"]
143153
pub fn lexical_ordering(o1: Ordering, o2: Ordering) -> Ordering {
144154
match o1 {
145155
Equal => o2,
@@ -157,6 +167,7 @@ pub fn lexical_ordering(o1: Ordering, o2: Ordering) -> Ordering {
157167
/// `NaN < 0 == false` and `NaN >= 0 == false` (cf. IEEE 754-2008 section
158168
/// 5.11).
159169
#[lang="ord"]
170+
#[unstable = "Definition may change slightly after trait reform"]
160171
pub trait PartialOrd: PartialEq {
161172
/// This method returns an ordering between `self` and `other` values
162173
/// if one exists.
@@ -202,19 +213,22 @@ pub trait PartialOrd: PartialEq {
202213
/// of different types. The most common use case for this relation is
203214
/// container types; e.g. it is often desirable to be able to use `&str`
204215
/// values to look up entries in a container with `String` keys.
216+
#[experimental = "Better solutions may be discovered."]
205217
pub trait Equiv<T> {
206218
/// Implement this function to decide equivalent values.
207219
fn equiv(&self, other: &T) -> bool;
208220
}
209221

210222
/// Compare and return the minimum of two values.
211223
#[inline]
224+
#[stable]
212225
pub fn min<T: Ord>(v1: T, v2: T) -> T {
213226
if v1 < v2 { v1 } else { v2 }
214227
}
215228

216229
/// Compare and return the maximum of two values.
217230
#[inline]
231+
#[stable]
218232
pub fn max<T: Ord>(v1: T, v2: T) -> T {
219233
if v1 > v2 { v1 } else { v2 }
220234
}
@@ -227,6 +241,7 @@ mod impls {
227241

228242
macro_rules! eq_impl(
229243
($($t:ty)*) => ($(
244+
#[unstable = "Trait is unstable."]
230245
impl PartialEq for $t {
231246
#[inline]
232247
fn eq(&self, other: &$t) -> bool { (*self) == (*other) }
@@ -236,6 +251,7 @@ mod impls {
236251
)*)
237252
)
238253

254+
#[unstable = "Trait is unstable."]
239255
impl PartialEq for () {
240256
#[inline]
241257
fn eq(&self, _other: &()) -> bool { true }
@@ -247,6 +263,7 @@ mod impls {
247263

248264
macro_rules! totaleq_impl(
249265
($($t:ty)*) => ($(
266+
#[unstable = "Trait is unstable."]
250267
impl Eq for $t {}
251268
)*)
252269
)
@@ -255,6 +272,7 @@ mod impls {
255272

256273
macro_rules! ord_impl(
257274
($($t:ty)*) => ($(
275+
#[unstable = "Trait is unstable."]
258276
impl PartialOrd for $t {
259277
#[inline]
260278
fn partial_cmp(&self, other: &$t) -> Option<Ordering> {
@@ -277,13 +295,15 @@ mod impls {
277295
)*)
278296
)
279297

298+
#[unstable = "Trait is unstable."]
280299
impl PartialOrd for () {
281300
#[inline]
282301
fn partial_cmp(&self, _: &()) -> Option<Ordering> {
283302
Some(Equal)
284303
}
285304
}
286305

306+
#[unstable = "Trait is unstable."]
287307
impl PartialOrd for bool {
288308
#[inline]
289309
fn partial_cmp(&self, other: &bool) -> Option<Ordering> {
@@ -295,6 +315,7 @@ mod impls {
295315

296316
macro_rules! totalord_impl(
297317
($($t:ty)*) => ($(
318+
#[unstable = "Trait is unstable."]
298319
impl Ord for $t {
299320
#[inline]
300321
fn cmp(&self, other: &$t) -> Ordering {
@@ -306,11 +327,13 @@ mod impls {
306327
)*)
307328
)
308329

330+
#[unstable = "Trait is unstable."]
309331
impl Ord for () {
310332
#[inline]
311333
fn cmp(&self, _other: &()) -> Ordering { Equal }
312334
}
313335

336+
#[unstable = "Trait is unstable."]
314337
impl Ord for bool {
315338
#[inline]
316339
fn cmp(&self, other: &bool) -> Ordering {
@@ -321,12 +344,14 @@ mod impls {
321344
totalord_impl!(char uint u8 u16 u32 u64 int i8 i16 i32 i64)
322345

323346
// & pointers
347+
#[unstable = "Trait is unstable."]
324348
impl<'a, T: PartialEq> PartialEq for &'a T {
325349
#[inline]
326350
fn eq(&self, other: & &'a T) -> bool { *(*self) == *(*other) }
327351
#[inline]
328352
fn ne(&self, other: & &'a T) -> bool { *(*self) != *(*other) }
329353
}
354+
#[unstable = "Trait is unstable."]
330355
impl<'a, T: PartialOrd> PartialOrd for &'a T {
331356
#[inline]
332357
fn partial_cmp(&self, other: &&'a T) -> Option<Ordering> {
@@ -341,19 +366,23 @@ mod impls {
341366
#[inline]
342367
fn gt(&self, other: & &'a T) -> bool { *(*self) > *(*other) }
343368
}
369+
#[unstable = "Trait is unstable."]
344370
impl<'a, T: Ord> Ord for &'a T {
345371
#[inline]
346372
fn cmp(&self, other: & &'a T) -> Ordering { (**self).cmp(*other) }
347373
}
374+
#[unstable = "Trait is unstable."]
348375
impl<'a, T: Eq> Eq for &'a T {}
349376

350377
// &mut pointers
378+
#[unstable = "Trait is unstable."]
351379
impl<'a, T: PartialEq> PartialEq for &'a mut T {
352380
#[inline]
353381
fn eq(&self, other: &&'a mut T) -> bool { **self == *(*other) }
354382
#[inline]
355383
fn ne(&self, other: &&'a mut T) -> bool { **self != *(*other) }
356384
}
385+
#[unstable = "Trait is unstable."]
357386
impl<'a, T: PartialOrd> PartialOrd for &'a mut T {
358387
#[inline]
359388
fn partial_cmp(&self, other: &&'a mut T) -> Option<Ordering> {
@@ -368,9 +397,11 @@ mod impls {
368397
#[inline]
369398
fn gt(&self, other: &&'a mut T) -> bool { **self > **other }
370399
}
400+
#[unstable = "Trait is unstable."]
371401
impl<'a, T: Ord> Ord for &'a mut T {
372402
#[inline]
373403
fn cmp(&self, other: &&'a mut T) -> Ordering { (**self).cmp(*other) }
374404
}
405+
#[unstable = "Trait is unstable."]
375406
impl<'a, T: Eq> Eq for &'a mut T {}
376407
}

src/libcore/default.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
//! The `Default` trait for types which may have meaningful default values
1212
13+
#![stable]
14+
1315
/// A trait that types which have a useful default value should implement.
1416
pub trait Default {
1517
/// Return the "default value" for a type.

0 commit comments

Comments
 (0)