Skip to content

Commit b4a2823

Browse files
committed
More test fixes and fallout of stability changes
1 parent aa931e9 commit b4a2823

File tree

40 files changed

+111
-122
lines changed

40 files changed

+111
-122
lines changed

src/liballoc/arc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { Arc::strong_count(this)
290290
reason = "this function is unsafe with weak pointers")]
291291
pub unsafe fn get_mut<T: ?Sized>(this: &mut Arc<T>) -> Option<&mut T> {
292292
// FIXME(#24880) potential race with upgraded weak pointers here
293-
if strong_count(this) == 1 && weak_count(this) == 0 {
293+
if Arc::strong_count(this) == 1 && Arc::weak_count(this) == 0 {
294294
// This unsafety is ok because we're guaranteed that the pointer
295295
// returned is the *only* pointer that will ever be returned to T. Our
296296
// reference count is guaranteed to be 1 at this point, and we required

src/liballoc/boxed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl Box<Any> {
267267
if self.is::<T>() {
268268
unsafe {
269269
// Get the raw representation of the trait object
270-
let raw = into_raw(self);
270+
let raw = Box::into_raw(self);
271271
let to: TraitObject =
272272
mem::transmute::<*mut Any, TraitObject>(raw);
273273

src/liballoc/rc.rs

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -148,26 +148,24 @@
148148
//! ```
149149
150150
#![stable(feature = "rust1", since = "1.0.0")]
151+
152+
use core::prelude::*;
153+
151154
#[cfg(not(test))]
152-
use boxed;
155+
use boxed::Box;
153156
#[cfg(test)]
154-
use std::boxed;
157+
use std::boxed::Box;
158+
155159
use core::cell::Cell;
156-
use core::clone::Clone;
157-
use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering};
158-
use core::default::Default;
160+
use core::cmp::Ordering;
159161
use core::fmt;
160162
use core::hash::{Hasher, Hash};
161163
use core::intrinsics::{assume, drop_in_place};
162-
use core::marker::{self, Sized, Unsize};
164+
use core::marker::{self, Unsize};
163165
use core::mem::{self, min_align_of, size_of, min_align_of_val, size_of_val, forget};
164166
use core::nonzero::NonZero;
165-
use core::ops::{CoerceUnsized, Deref, Drop};
166-
use core::option::Option;
167-
use core::option::Option::{Some, None};
167+
use core::ops::{CoerceUnsized, Deref};
168168
use core::ptr;
169-
use core::result::Result;
170-
use core::result::Result::{Ok, Err};
171169

172170
use heap::deallocate;
173171

@@ -212,7 +210,7 @@ impl<T> Rc<T> {
212210
// pointers, which ensures that the weak destructor never frees
213211
// the allocation while the strong destructor is running, even
214212
// if the weak pointer is stored inside the strong one.
215-
_ptr: NonZero::new(boxed::into_raw(box RcBox {
213+
_ptr: NonZero::new(Box::into_raw(box RcBox {
216214
strong: Cell::new(1),
217215
weak: Cell::new(1),
218216
value: value
@@ -230,14 +228,14 @@ impl<T> Rc<T> {
230228
///
231229
/// ```
232230
/// # #![feature(rc_unique)]
233-
/// use std::rc::{self, Rc};
231+
/// use std::rc::Rc;
234232
///
235233
/// let x = Rc::new(3);
236-
/// assert_eq!(rc::try_unwrap(x), Ok(3));
234+
/// assert_eq!(Rc::try_unwrap(x), Ok(3));
237235
///
238236
/// let x = Rc::new(4);
239237
/// let _y = x.clone();
240-
/// assert_eq!(rc::try_unwrap(x), Err(Rc::new(4)));
238+
/// assert_eq!(Rc::try_unwrap(x), Err(Rc::new(4)));
241239
/// ```
242240
#[inline]
243241
#[unstable(feature = "rc_unique")]
@@ -295,17 +293,16 @@ impl<T: ?Sized> Rc<T> {
295293
///
296294
/// ```
297295
/// # #![feature(rc_unique)]
298-
/// use std::rc;
299296
/// use std::rc::Rc;
300297
///
301298
/// let five = Rc::new(5);
302299
///
303-
/// rc::is_unique(&five);
300+
/// assert!(Rc::is_unique(&five));
304301
/// ```
305302
#[inline]
306303
#[unstable(feature = "rc_unique")]
307304
pub fn is_unique(rc: &Rc<T>) -> bool {
308-
weak_count(rc) == 0 && strong_count(rc) == 1
305+
Rc::weak_count(rc) == 0 && Rc::strong_count(rc) == 1
309306
}
310307

311308
/// Returns a mutable reference to the contained value if the `Rc<T>` is
@@ -317,14 +314,14 @@ impl<T: ?Sized> Rc<T> {
317314
///
318315
/// ```
319316
/// # #![feature(rc_unique)]
320-
/// use std::rc::{self, Rc};
317+
/// use std::rc::Rc;
321318
///
322319
/// let mut x = Rc::new(3);
323-
/// *rc::get_mut(&mut x).unwrap() = 4;
320+
/// *Rc::get_mut(&mut x).unwrap() = 4;
324321
/// assert_eq!(*x, 4);
325322
///
326323
/// let _y = x.clone();
327-
/// assert!(rc::get_mut(&mut x).is_none());
324+
/// assert!(Rc::get_mut(&mut x).is_none());
328325
/// ```
329326
#[inline]
330327
#[unstable(feature = "rc_unique")]
@@ -432,7 +429,7 @@ impl<T: Clone> Rc<T> {
432429
#[inline]
433430
#[unstable(feature = "rc_unique")]
434431
pub fn make_unique(&mut self) -> &mut T {
435-
if !is_unique(self) {
432+
if !Rc::is_unique(self) {
436433
*self = Rc::new((**self).clone())
437434
}
438435
// This unsafety is ok because we're guaranteed that the pointer

src/libcollections/bit.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ use core::cmp::Ordering;
8686
use core::cmp;
8787
use core::fmt;
8888
use core::hash;
89+
#[allow(deprecated)]
8990
use core::iter::RandomAccessIterator;
9091
use core::iter::{Chain, Enumerate, Repeat, Skip, Take, repeat, Cloned};
9192
use core::iter::{self, FromIterator};
@@ -1188,6 +1189,7 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
11881189
impl<'a> ExactSizeIterator for Iter<'a> {}
11891190

11901191
#[stable(feature = "rust1", since = "1.0.0")]
1192+
#[allow(deprecated)]
11911193
impl<'a> RandomAccessIterator for Iter<'a> {
11921194
#[inline]
11931195
fn indexable(&self) -> usize {

src/libcollections/btree/map.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -685,10 +685,7 @@ mod stack {
685685
/// tied to the original tree.
686686
pub fn into_top(mut self) -> &'a mut V {
687687
unsafe {
688-
mem::copy_mut_lifetime(
689-
self.map,
690-
self.top.from_raw_mut().val_mut()
691-
)
688+
&mut *(self.top.from_raw_mut().val_mut() as *mut V)
692689
}
693690
}
694691
}

src/libcollections/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#![feature(box_patterns)]
3535
#![feature(box_raw)]
3636
#![feature(box_syntax)]
37-
#![feature(copy_lifetime)]
3837
#![feature(core)]
3938
#![feature(core_intrinsics)]
4039
#![feature(core_prelude)]
@@ -56,7 +55,7 @@
5655
#![feature(staged_api)]
5756
#![feature(step_by)]
5857
#![feature(str_char)]
59-
#![feature(str_internals)]
58+
#![feature(str_match_indices)]
6059
#![feature(unboxed_closures)]
6160
#![feature(unicode)]
6261
#![feature(unique)]

src/libcollections/slice.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ mod hack {
151151
}
152152
}
153153

154+
#[allow(deprecated)]
154155
pub fn permutations<T>(s: &[T]) -> Permutations<T> where T: Clone {
155156
Permutations{
156157
swaps: ElementSwaps::new(s.len()),
@@ -871,6 +872,7 @@ impl<T> [T] {
871872
/// assert_eq!(Some(vec![1, 3, 2]), perms.next());
872873
/// assert_eq!(Some(vec![3, 1, 2]), perms.next());
873874
/// ```
875+
#[allow(deprecated)]
874876
#[unstable(feature = "permutations")]
875877
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
876878
#[inline]
@@ -896,6 +898,7 @@ impl<T> [T] {
896898
/// let b: &mut [_] = &mut [1, 0, 2];
897899
/// assert!(v == b);
898900
/// ```
901+
#[allow(deprecated)]
899902
#[unstable(feature = "permutations",
900903
reason = "uncertain if this merits inclusion in std")]
901904
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
@@ -920,6 +923,7 @@ impl<T> [T] {
920923
/// let b: &mut [_] = &mut [0, 1, 2];
921924
/// assert!(v == b);
922925
/// ```
926+
#[allow(deprecated)]
923927
#[unstable(feature = "permutations",
924928
reason = "uncertain if this merits inclusion in std")]
925929
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
@@ -1067,6 +1071,7 @@ impl<T: Clone, V: Borrow<[T]>> SliceConcatExt<T> for [V] {
10671071
///
10681072
/// The last generated swap is always (0, 1), and it returns the
10691073
/// sequence to its initial order.
1074+
#[allow(deprecated)]
10701075
#[unstable(feature = "permutations")]
10711076
#[derive(Clone)]
10721077
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
@@ -1078,6 +1083,7 @@ pub struct ElementSwaps {
10781083
swaps_made : usize,
10791084
}
10801085

1086+
#[allow(deprecated)]
10811087
impl ElementSwaps {
10821088
/// Creates an `ElementSwaps` iterator for a sequence of `length` elements.
10831089
#[unstable(feature = "permutations")]
@@ -1137,6 +1143,7 @@ struct SizeDirection {
11371143
}
11381144

11391145
#[stable(feature = "rust1", since = "1.0.0")]
1146+
#[allow(deprecated)]
11401147
impl Iterator for ElementSwaps {
11411148
type Item = (usize, usize);
11421149

@@ -1205,12 +1212,14 @@ impl Iterator for ElementSwaps {
12051212
/// Generates even and odd permutations alternately.
12061213
#[unstable(feature = "permutations")]
12071214
#[deprecated(since = "1.2.0", reason = "not clear this should be in the stdlib")]
1215+
#[allow(deprecated)]
12081216
pub struct Permutations<T> {
12091217
swaps: ElementSwaps,
12101218
v: Vec<T>,
12111219
}
12121220

12131221
#[unstable(feature = "permutations", reason = "trait is unstable")]
1222+
#[allow(deprecated)]
12141223
impl<T: Clone> Iterator for Permutations<T> {
12151224
type Item = Vec<T>;
12161225

src/libcollections/str.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,6 @@ impl str {
15201520
/// # Examples
15211521
///
15221522
/// ```
1523-
/// # #![feature(str_matches)]
15241523
/// let v: Vec<&str> = "abcXXXabcYYYabc".matches("abc").collect();
15251524
/// assert_eq!(v, ["abc", "abc", "abc"]);
15261525
///
@@ -1552,7 +1551,6 @@ impl str {
15521551
/// # Examples
15531552
///
15541553
/// ```
1555-
/// # #![feature(str_matches)]
15561554
/// let v: Vec<&str> = "abcXXXabcYYYabc".rmatches("abc").collect();
15571555
/// assert_eq!(v, ["abc", "abc", "abc"]);
15581556
///
@@ -1593,7 +1591,7 @@ impl str {
15931591
/// # Examples
15941592
///
15951593
/// ```
1596-
/// # #![feature(str_matches)]
1594+
/// # #![feature(str_match_indices)]
15971595
/// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".match_indices("abc").collect();
15981596
/// assert_eq!(v, [(0, 3), (6, 9), (12, 15)]);
15991597
///
@@ -1637,7 +1635,7 @@ impl str {
16371635
/// # Examples
16381636
///
16391637
/// ```
1640-
/// # #![feature(str_matches)]
1638+
/// # #![feature(str_match_indices)]
16411639
/// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".rmatch_indices("abc").collect();
16421640
/// assert_eq!(v, [(12, 15), (6, 9), (0, 3)]);
16431641
///

src/libcollections/vec.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,12 +1709,14 @@ impl<'a, T> FromIterator<T> for Cow<'a, [T]> where T: Clone {
17091709
}
17101710
}
17111711

1712+
#[allow(deprecated)]
17121713
impl<'a, T: 'a> IntoCow<'a, [T]> for Vec<T> where T: Clone {
17131714
fn into_cow(self) -> Cow<'a, [T]> {
17141715
Cow::Owned(self)
17151716
}
17161717
}
17171718

1719+
#[allow(deprecated)]
17181720
impl<'a, T> IntoCow<'a, [T]> for &'a [T] where T: Clone {
17191721
fn into_cow(self) -> Cow<'a, [T]> {
17201722
Cow::Borrowed(self)

src/libcollections/vec_deque.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,7 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
15301530
impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
15311531

15321532
#[stable(feature = "rust1", since = "1.0.0")]
1533+
#[allow(deprecated)]
15331534
impl<'a, T> RandomAccessIterator for Iter<'a, T> {
15341535
#[inline]
15351536
fn indexable(&self) -> usize {

src/libcollectionstest/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#![feature(step_by)]
4444
#![feature(str_char)]
4545
#![feature(str_escape)]
46-
#![feature(str_matches)]
46+
#![feature(str_match_indices)]
4747
#![feature(str_utf16)]
4848
#![feature(subslice_offset)]
4949
#![feature(test)]

0 commit comments

Comments
 (0)