Skip to content

Commit 39f3c16

Browse files
committed
Merge pull request #33883 from alexcrichton/beta-next
Backport API stabilizations and an FFI fix
2 parents b27d595 + 39b428b commit 39f3c16

File tree

42 files changed

+649
-531
lines changed

Some content is hidden

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

42 files changed

+649
-531
lines changed

mk/main.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ CFG_RELEASE_NUM=1.10.0
1818
# An optional number to put after the label, e.g. '.2' -> '-beta.2'
1919
# NB Make sure it starts with a dot to conform to semver pre-release
2020
# versions (section 9)
21-
CFG_PRERELEASE_VERSION=.1
21+
CFG_PRERELEASE_VERSION=.2
2222

2323
# Append a version-dependent hash to each library, so we can install different
2424
# versions in the same place

src/liballoc/arc.rs

+32-29
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,31 @@ impl<T: ?Sized> Drop for Arc<T> {
592592
}
593593
}
594594

595+
impl<T> Weak<T> {
596+
/// Constructs a new `Weak<T>` without an accompanying instance of T.
597+
///
598+
/// This allocates memory for T, but does not initialize it. Calling
599+
/// Weak<T>::upgrade() on the return value always gives None.
600+
///
601+
/// # Examples
602+
///
603+
/// ```
604+
/// use std::sync::Weak;
605+
///
606+
/// let empty: Weak<i64> = Weak::new();
607+
/// ```
608+
#[stable(feature = "downgraded_weak", since = "1.10.0")]
609+
pub fn new() -> Weak<T> {
610+
unsafe {
611+
Weak { ptr: Shared::new(Box::into_raw(box ArcInner {
612+
strong: atomic::AtomicUsize::new(0),
613+
weak: atomic::AtomicUsize::new(1),
614+
data: uninitialized(),
615+
}))}
616+
}
617+
}
618+
}
619+
595620
impl<T: ?Sized> Weak<T> {
596621
/// Upgrades a weak reference to a strong reference.
597622
///
@@ -682,6 +707,13 @@ impl<T: ?Sized> Clone for Weak<T> {
682707
}
683708
}
684709

710+
#[stable(feature = "downgraded_weak", since = "1.10.0")]
711+
impl<T> Default for Weak<T> {
712+
fn default() -> Weak<T> {
713+
Weak::new()
714+
}
715+
}
716+
685717
#[stable(feature = "arc_weak", since = "1.4.0")]
686718
impl<T: ?Sized> Drop for Weak<T> {
687719
/// Drops the `Weak<T>`.
@@ -907,35 +939,6 @@ impl<T> From<T> for Arc<T> {
907939
}
908940
}
909941

910-
impl<T> Weak<T> {
911-
/// Constructs a new `Weak<T>` without an accompanying instance of T.
912-
///
913-
/// This allocates memory for T, but does not initialize it. Calling
914-
/// Weak<T>::upgrade() on the return value always gives None.
915-
///
916-
/// # Examples
917-
///
918-
/// ```
919-
/// #![feature(downgraded_weak)]
920-
///
921-
/// use std::sync::Weak;
922-
///
923-
/// let empty: Weak<i64> = Weak::new();
924-
/// ```
925-
#[unstable(feature = "downgraded_weak",
926-
reason = "recently added",
927-
issue = "30425")]
928-
pub fn new() -> Weak<T> {
929-
unsafe {
930-
Weak { ptr: Shared::new(Box::into_raw(box ArcInner {
931-
strong: atomic::AtomicUsize::new(0),
932-
weak: atomic::AtomicUsize::new(1),
933-
data: uninitialized(),
934-
}))}
935-
}
936-
}
937-
}
938-
939942
#[cfg(test)]
940943
mod tests {
941944
use std::clone::Clone;

src/liballoc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
#![feature(unique)]
9191
#![feature(unsafe_no_drop_flag, filling_drop)]
9292
#![feature(unsize)]
93-
#![feature(extended_compare_and_swap)]
9493

9594
#![cfg_attr(not(test), feature(raw, fn_traits, placement_new_protocol))]
9695
#![cfg_attr(test, feature(test, box_heap))]

src/liballoc/rc.rs

+31-28
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,33 @@ impl<T: ?Sized> !marker::Sync for Weak<T> {}
720720
#[unstable(feature = "coerce_unsized", issue = "27732")]
721721
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Weak<U>> for Weak<T> {}
722722

723+
impl<T> Weak<T> {
724+
/// Constructs a new `Weak<T>` without an accompanying instance of T.
725+
///
726+
/// This allocates memory for T, but does not initialize it. Calling
727+
/// Weak<T>::upgrade() on the return value always gives None.
728+
///
729+
/// # Examples
730+
///
731+
/// ```
732+
/// use std::rc::Weak;
733+
///
734+
/// let empty: Weak<i64> = Weak::new();
735+
/// ```
736+
#[stable(feature = "downgraded_weak", since = "1.10.0")]
737+
pub fn new() -> Weak<T> {
738+
unsafe {
739+
Weak {
740+
ptr: Shared::new(Box::into_raw(box RcBox {
741+
strong: Cell::new(0),
742+
weak: Cell::new(1),
743+
value: uninitialized(),
744+
})),
745+
}
746+
}
747+
}
748+
}
749+
723750
impl<T: ?Sized> Weak<T> {
724751
/// Upgrades a weak reference to a strong reference.
725752
///
@@ -823,34 +850,10 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for Weak<T> {
823850
}
824851
}
825852

826-
impl<T> Weak<T> {
827-
/// Constructs a new `Weak<T>` without an accompanying instance of T.
828-
///
829-
/// This allocates memory for T, but does not initialize it. Calling
830-
/// Weak<T>::upgrade() on the return value always gives None.
831-
///
832-
/// # Examples
833-
///
834-
/// ```
835-
/// #![feature(downgraded_weak)]
836-
///
837-
/// use std::rc::Weak;
838-
///
839-
/// let empty: Weak<i64> = Weak::new();
840-
/// ```
841-
#[unstable(feature = "downgraded_weak",
842-
reason = "recently added",
843-
issue="30425")]
844-
pub fn new() -> Weak<T> {
845-
unsafe {
846-
Weak {
847-
ptr: Shared::new(Box::into_raw(box RcBox {
848-
strong: Cell::new(0),
849-
weak: Cell::new(1),
850-
value: uninitialized(),
851-
})),
852-
}
853-
}
853+
#[stable(feature = "downgraded_weak", since = "1.10.0")]
854+
impl<T> Default for Weak<T> {
855+
fn default() -> Weak<T> {
856+
Weak::new()
854857
}
855858
}
856859

src/libcollections/btree/map.rs

+9-10
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ pub struct Values<'a, K: 'a, V: 'a> {
286286
}
287287

288288
/// A mutable iterator over a BTreeMap's values.
289-
#[unstable(feature = "map_values_mut", reason = "recently added", issue = "32551")]
289+
#[stable(feature = "map_values_mut", since = "1.10.0")]
290290
pub struct ValuesMut<'a, K: 'a, V: 'a> {
291291
inner: IterMut<'a, K, V>,
292292
}
@@ -1144,7 +1144,7 @@ impl<'a, K, V> Iterator for Range<'a, K, V> {
11441144
}
11451145
}
11461146

1147-
#[unstable(feature = "map_values_mut", reason = "recently added", issue = "32551")]
1147+
#[stable(feature = "map_values_mut", since = "1.10.0")]
11481148
impl<'a, K, V> Iterator for ValuesMut<'a, K, V> {
11491149
type Item = &'a mut V;
11501150

@@ -1157,14 +1157,14 @@ impl<'a, K, V> Iterator for ValuesMut<'a, K, V> {
11571157
}
11581158
}
11591159

1160-
#[unstable(feature = "map_values_mut", reason = "recently added", issue = "32551")]
1160+
#[stable(feature = "map_values_mut", since = "1.10.0")]
11611161
impl<'a, K, V> DoubleEndedIterator for ValuesMut<'a, K, V> {
11621162
fn next_back(&mut self) -> Option<&'a mut V> {
11631163
self.inner.next_back().map(|(_, v)| v)
11641164
}
11651165
}
11661166

1167-
#[unstable(feature = "map_values_mut", reason = "recently added", issue = "32551")]
1167+
#[stable(feature = "map_values_mut", since = "1.10.0")]
11681168
impl<'a, K, V> ExactSizeIterator for ValuesMut<'a, K, V> {
11691169
fn len(&self) -> usize {
11701170
self.inner.len()
@@ -1575,7 +1575,6 @@ impl<K, V> BTreeMap<K, V> {
15751575
/// Basic usage:
15761576
///
15771577
/// ```
1578-
/// # #![feature(map_values_mut)]
15791578
/// use std::collections::BTreeMap;
15801579
///
15811580
/// let mut a = BTreeMap::new();
@@ -1590,8 +1589,8 @@ impl<K, V> BTreeMap<K, V> {
15901589
/// assert_eq!(values, [String::from("hello!"),
15911590
/// String::from("goodbye!")]);
15921591
/// ```
1593-
#[unstable(feature = "map_values_mut", reason = "recently added", issue = "32551")]
1594-
pub fn values_mut<'a>(&'a mut self) -> ValuesMut<'a, K, V> {
1592+
#[stable(feature = "map_values_mut", since = "1.10.0")]
1593+
pub fn values_mut(&mut self) -> ValuesMut<K, V> {
15951594
ValuesMut { inner: self.iter_mut() }
15961595
}
15971596

@@ -1656,7 +1655,7 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
16561655
}
16571656

16581657
/// Returns a reference to this entry's key.
1659-
#[unstable(feature = "map_entry_keys", issue = "32281")]
1658+
#[stable(feature = "map_entry_keys", since = "1.10.0")]
16601659
pub fn key(&self) -> &K {
16611660
match *self {
16621661
Occupied(ref entry) => entry.key(),
@@ -1668,7 +1667,7 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
16681667
impl<'a, K: Ord, V> VacantEntry<'a, K, V> {
16691668
/// Gets a reference to the key that would be used when inserting a value
16701669
/// through the VacantEntry.
1671-
#[unstable(feature = "map_entry_keys", issue = "32281")]
1670+
#[stable(feature = "map_entry_keys", since = "1.10.0")]
16721671
pub fn key(&self) -> &K {
16731672
&self.key
16741673
}
@@ -1718,7 +1717,7 @@ impl<'a, K: Ord, V> VacantEntry<'a, K, V> {
17181717

17191718
impl<'a, K: Ord, V> OccupiedEntry<'a, K, V> {
17201719
/// Gets a reference to the key in the entry.
1721-
#[unstable(feature = "map_entry_keys", issue = "32281")]
1720+
#[stable(feature = "map_entry_keys", since = "1.10.0")]
17221721
pub fn key(&self) -> &K {
17231722
self.handle.reborrow().into_kv().0
17241723
}

src/libcollections/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
2828

2929
#![cfg_attr(test, allow(deprecated))] // rand
30-
#![cfg_attr(not(test), feature(slice_binary_search_by_key))] // impl [T]
3130
#![cfg_attr(not(stage0), deny(warnings))]
3231

3332
#![feature(alloc)]

src/libcollections/slice.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,6 @@ impl<T> [T] {
759759
/// fourth could match any position in `[1,4]`.
760760
///
761761
/// ```rust
762-
/// #![feature(slice_binary_search_by_key)]
763762
/// let s = [(0, 0), (2, 1), (4, 1), (5, 1), (3, 1),
764763
/// (1, 2), (2, 3), (4, 5), (5, 8), (3, 13),
765764
/// (1, 21), (2, 34), (4, 55)];
@@ -770,7 +769,7 @@ impl<T> [T] {
770769
/// let r = s.binary_search_by_key(&1, |&(a,b)| b);
771770
/// assert!(match r { Ok(1...4) => true, _ => false, });
772771
/// ```
773-
#[unstable(feature = "slice_binary_search_by_key", reason = "recently added", issue = "33018")]
772+
#[stable(feature = "slice_binary_search_by_key", since = "1.10.0")]
774773
#[inline]
775774
pub fn binary_search_by_key<B, F>(&self, b: &B, f: F) -> Result<usize, usize>
776775
where F: FnMut(&T) -> B,

src/libcollectionstest/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#![feature(enumset)]
2323
#![feature(iter_arith)]
2424
#![feature(linked_list_contains)]
25-
#![feature(map_entry_keys)]
26-
#![feature(map_values_mut)]
2725
#![feature(pattern)]
2826
#![feature(rand)]
2927
#![feature(step_by)]

src/libcore/char.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515
#![allow(non_snake_case)]
1616
#![stable(feature = "core_char", since = "1.2.0")]
1717

18-
use iter::Iterator;
18+
use prelude::v1::*;
19+
1920
use mem::transmute;
20-
use option::Option::{None, Some};
21-
use option::Option;
22-
use slice::SliceExt;
2321

2422
// UTF-8 ranges and tags for encoding characters
2523
const TAG_CONT: u8 = 0b1000_0000;

src/libcore/iter/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,7 @@ impl<I: Iterator> Peekable<I> {
11251125
/// ```
11261126
#[unstable(feature = "peekable_is_empty", issue = "32111")]
11271127
#[inline]
1128+
#[rustc_deprecated(since = "1.10.0", reason = "replaced by .peek().is_none()")]
11281129
pub fn is_empty(&mut self) -> bool {
11291130
self.peek().is_none()
11301131
}

src/libcore/slice.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ pub trait SliceExt {
106106
#[stable(feature = "core", since = "1.6.0")]
107107
fn binary_search_by<F>(&self, f: F) -> Result<usize, usize>
108108
where F: FnMut(&Self::Item) -> Ordering;
109+
#[stable(feature = "slice_binary_search_by_key", since = "1.10.0")]
110+
fn binary_search_by_key<B, F>(&self, b: &B, f: F) -> Result<usize, usize>
111+
where F: FnMut(&Self::Item) -> B,
112+
B: Ord;
109113
#[stable(feature = "core", since = "1.6.0")]
110114
fn len(&self) -> usize;
111115
#[stable(feature = "core", since = "1.6.0")]
@@ -157,11 +161,6 @@ pub trait SliceExt {
157161
fn clone_from_slice(&mut self, src: &[Self::Item]) where Self::Item: Clone;
158162
#[stable(feature = "copy_from_slice", since = "1.9.0")]
159163
fn copy_from_slice(&mut self, src: &[Self::Item]) where Self::Item: Copy;
160-
161-
#[unstable(feature = "slice_binary_search_by_key", reason = "recently added", issue = "33018")]
162-
fn binary_search_by_key<B, F>(&self, b: &B, f: F) -> Result<usize, usize>
163-
where F: FnMut(&Self::Item) -> B,
164-
B: Ord;
165164
}
166165

167166
// Use macros to be generic over const/mut

0 commit comments

Comments
 (0)