Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[beta] Prepare Rust 1.70.0 #110414

Merged
merged 5 commits into from
Apr 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
@@ -239,7 +239,7 @@ declare_features! (
/// Allows using `Self` and associated types in struct expressions and patterns.
(accepted, more_struct_aliases, "1.16.0", Some(37544), None),
/// Allows using the MOVBE target feature.
(accepted, movbe_target_feature, "CURRENT_RUSTC_VERSION", Some(44839), None),
(accepted, movbe_target_feature, "1.70.0", Some(44839), None),
/// Allows patterns with concurrent by-move and by-ref bindings.
/// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref.
(accepted, move_ref_pattern, "1.49.0", Some(68354), None),
6 changes: 3 additions & 3 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
@@ -417,7 +417,7 @@ declare_features! (
/// Allows `if let` guard in match arms.
(active, if_let_guard, "1.47.0", Some(51114), None),
/// Allows `impl Trait` to be used inside associated types (RFC 2515).
(active, impl_trait_in_assoc_type, "CURRENT_RUSTC_VERSION", Some(63063), None),
(active, impl_trait_in_assoc_type, "1.70.0", Some(63063), None),
/// Allows `impl Trait` as output type in `Fn` traits in return position of functions.
(active, impl_trait_in_fn_trait_return, "1.64.0", Some(99697), None),
/// Allows referencing `Self` and projections in impl-trait.
@@ -498,7 +498,7 @@ declare_features! (
/// Allows return-position `impl Trait` in traits.
(incomplete, return_position_impl_trait_in_trait, "1.65.0", Some(91611), None),
/// Allows bounding the return type of AFIT/RPITIT.
(incomplete, return_type_notation, "CURRENT_RUSTC_VERSION", Some(109417), None),
(incomplete, return_type_notation, "1.70.0", Some(109417), None),
/// Allows `extern "rust-cold"`.
(active, rust_cold_cc, "1.63.0", Some(97544), None),
/// Allows the use of SIMD types in functions declared in `extern` blocks.
@@ -521,7 +521,7 @@ declare_features! (
/// Dyn upcasting is casting, e.g., `dyn Foo -> dyn Bar` where `Foo: Bar`.
(active, trait_upcasting, "1.56.0", Some(65991), None),
/// Allows for transmuting between arrays with sizes that contain generic consts.
(active, transmute_generic_consts, "CURRENT_RUSTC_VERSION", Some(109929), None),
(active, transmute_generic_consts, "1.70.0", Some(109929), None),
/// Allows #[repr(transparent)] on unions (RFC 2645).
(active, transparent_unions, "1.37.0", Some(60405), None),
/// Allows inconsistent bounds in where clauses.
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/removed.rs
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ declare_features! (
(removed, await_macro, "1.38.0", Some(50547), None,
Some("subsumed by `.await` syntax")),
/// Allows using the `box $expr` syntax.
(removed, box_syntax, "CURRENT_RUSTC_VERSION", Some(49733), None, Some("replaced with `#[rustc_box]`")),
(removed, box_syntax, "1.70.0", Some(49733), None, Some("replaced with `#[rustc_box]`")),
/// Allows capturing disjoint fields in a closure/generator (RFC 2229).
(removed, capture_disjoint_fields, "1.49.0", Some(53488), None, Some("stabilized in Rust 2021")),
/// Allows comparing raw pointers during const eval.
4 changes: 2 additions & 2 deletions library/alloc/src/collections/binary_heap/mod.rs
Original file line number Diff line number Diff line change
@@ -853,7 +853,7 @@ impl<T: Ord> BinaryHeap<T> {
///
/// assert_eq!(heap.into_sorted_vec(), [-10, 2, 4])
/// ```
#[stable(feature = "binary_heap_retain", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "binary_heap_retain", since = "1.70.0")]
pub fn retain<F>(&mut self, mut f: F)
where
F: FnMut(&T) -> bool,
@@ -1463,7 +1463,7 @@ impl<T> ExactSizeIterator for IntoIter<T> {
#[stable(feature = "fused", since = "1.26.0")]
impl<T> FusedIterator for IntoIter<T> {}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<T> Default for IntoIter<T> {
/// Creates an empty `binary_heap::IntoIter`.
///
16 changes: 8 additions & 8 deletions library/alloc/src/collections/btree/map.rs
Original file line number Diff line number Diff line change
@@ -362,7 +362,7 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Iter<'_, K, V> {
}
}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<'a, K: 'a, V: 'a> Default for Iter<'a, K, V> {
/// Creates an empty `btree_map::Iter`.
///
@@ -400,7 +400,7 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for IterMut<'_, K, V> {
}
}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<'a, K: 'a, V: 'a> Default for IterMut<'a, K, V> {
/// Creates an empty `btree_map::IterMut`.
///
@@ -448,7 +448,7 @@ impl<K: Debug, V: Debug, A: Allocator + Clone> Debug for IntoIter<K, V, A> {
}
}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<K, V, A> Default for IntoIter<K, V, A>
where
A: Allocator + Default + Clone,
@@ -1812,7 +1812,7 @@ impl<K, V> Clone for Keys<'_, K, V> {
}
}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<K, V> Default for Keys<'_, K, V> {
/// Creates an empty `btree_map::Keys`.
///
@@ -1867,7 +1867,7 @@ impl<K, V> Clone for Values<'_, K, V> {
}
}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<K, V> Default for Values<'_, K, V> {
/// Creates an empty `btree_map::Values`.
///
@@ -2017,7 +2017,7 @@ impl<'a, K, V> Iterator for Range<'a, K, V> {
}
}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<K, V> Default for Range<'_, K, V> {
/// Creates an empty `btree_map::Range`.
///
@@ -2107,7 +2107,7 @@ impl<K, V, A: Allocator + Clone> ExactSizeIterator for IntoKeys<K, V, A> {
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
impl<K, V, A: Allocator + Clone> FusedIterator for IntoKeys<K, V, A> {}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<K, V, A> Default for IntoKeys<K, V, A>
where
A: Allocator + Default + Clone,
@@ -2158,7 +2158,7 @@ impl<K, V, A: Allocator + Clone> ExactSizeIterator for IntoValues<K, V, A> {
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
impl<K, V, A: Allocator + Clone> FusedIterator for IntoValues<K, V, A> {}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<K, V, A> Default for IntoValues<K, V, A>
where
A: Allocator + Default + Clone,
6 changes: 3 additions & 3 deletions library/alloc/src/collections/btree/set.rs
Original file line number Diff line number Diff line change
@@ -1538,7 +1538,7 @@ impl<T, A: Allocator + Clone> Iterator for IntoIter<T, A> {
}
}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<T> Default for Iter<'_, T> {
/// Creates an empty `btree_set::Iter`.
///
@@ -1568,7 +1568,7 @@ impl<T, A: Allocator + Clone> ExactSizeIterator for IntoIter<T, A> {
#[stable(feature = "fused", since = "1.26.0")]
impl<T, A: Allocator + Clone> FusedIterator for IntoIter<T, A> {}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<T, A> Default for IntoIter<T, A>
where
A: Allocator + Default + Clone,
@@ -1623,7 +1623,7 @@ impl<'a, T> DoubleEndedIterator for Range<'a, T> {
#[stable(feature = "fused", since = "1.26.0")]
impl<T> FusedIterator for Range<'_, T> {}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<T> Default for Range<'_, T> {
/// Creates an empty `btree_set::Range`.
///
6 changes: 3 additions & 3 deletions library/alloc/src/collections/linked_list.rs
Original file line number Diff line number Diff line change
@@ -1074,7 +1074,7 @@ impl<T> ExactSizeIterator for Iter<'_, T> {}
#[stable(feature = "fused", since = "1.26.0")]
impl<T> FusedIterator for Iter<'_, T> {}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<T> Default for Iter<'_, T> {
/// Creates an empty `linked_list::Iter`.
///
@@ -1142,7 +1142,7 @@ impl<T> ExactSizeIterator for IterMut<'_, T> {}
#[stable(feature = "fused", since = "1.26.0")]
impl<T> FusedIterator for IterMut<'_, T> {}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<T> Default for IterMut<'_, T> {
fn default() -> Self {
IterMut { head: None, tail: None, len: 0, marker: Default::default() }
@@ -1828,7 +1828,7 @@ impl<T> ExactSizeIterator for IntoIter<T> {}
#[stable(feature = "fused", since = "1.26.0")]
impl<T> FusedIterator for IntoIter<T> {}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<T> Default for IntoIter<T> {
/// Creates an empty `linked_list::IntoIter`.
///
2 changes: 1 addition & 1 deletion library/alloc/src/rc.rs
Original file line number Diff line number Diff line change
@@ -693,7 +693,7 @@ impl<T> Rc<T> {
/// This is equivalent to `Rc::try_unwrap(this).ok()`. (Note that these are not equivalent for
/// [`Arc`](crate::sync::Arc), due to race conditions that do not apply to `Rc`.)
#[inline]
#[stable(feature = "rc_into_inner", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "rc_into_inner", since = "1.70.0")]
pub fn into_inner(this: Self) -> Option<T> {
Rc::try_unwrap(this).ok()
}
2 changes: 1 addition & 1 deletion library/alloc/src/sync.rs
Original file line number Diff line number Diff line change
@@ -793,7 +793,7 @@ impl<T> Arc<T> {
/// y_thread.join().unwrap();
/// ```
#[inline]
#[stable(feature = "arc_into_inner", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "arc_into_inner", since = "1.70.0")]
pub fn into_inner(this: Self) -> Option<T> {
// Make sure that the ordinary `Drop` implementation isn’t called as well
let mut this = mem::ManuallyDrop::new(this);
2 changes: 1 addition & 1 deletion library/alloc/src/vec/into_iter.rs
Original file line number Diff line number Diff line change
@@ -342,7 +342,7 @@ impl<T, A: Allocator> FusedIterator for IntoIter<T, A> {}
#[unstable(feature = "trusted_len", issue = "37572")]
unsafe impl<T, A: Allocator> TrustedLen for IntoIter<T, A> {}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<T, A> Default for IntoIter<T, A>
where
A: Allocator + Default,
2 changes: 1 addition & 1 deletion library/core/src/cell.rs
Original file line number Diff line number Diff line change
@@ -247,7 +247,7 @@ mod once;

#[unstable(feature = "lazy_cell", issue = "109736")]
pub use lazy::LazyCell;
#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
pub use once::OnceCell;

/// A mutable memory location.
32 changes: 16 additions & 16 deletions library/core/src/cell/once.rs
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ use crate::mem;
/// assert_eq!(value, "Hello, World!");
/// assert!(cell.get().is_some());
/// ```
#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
pub struct OnceCell<T> {
// Invariant: written to at most once.
inner: UnsafeCell<Option<T>>,
@@ -39,8 +39,8 @@ impl<T> OnceCell<T> {
/// Creates a new empty cell.
#[inline]
#[must_use]
#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
#[rustc_const_stable(feature = "once_cell", since = "1.70.0")]
pub const fn new() -> OnceCell<T> {
OnceCell { inner: UnsafeCell::new(None) }
}
@@ -49,7 +49,7 @@ impl<T> OnceCell<T> {
///
/// Returns `None` if the cell is empty.
#[inline]
#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
pub fn get(&self) -> Option<&T> {
// SAFETY: Safe due to `inner`'s invariant
unsafe { &*self.inner.get() }.as_ref()
@@ -59,7 +59,7 @@ impl<T> OnceCell<T> {
///
/// Returns `None` if the cell is empty.
#[inline]
#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
pub fn get_mut(&mut self) -> Option<&mut T> {
self.inner.get_mut().as_mut()
}
@@ -85,7 +85,7 @@ impl<T> OnceCell<T> {
/// assert!(cell.get().is_some());
/// ```
#[inline]
#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
pub fn set(&self, value: T) -> Result<(), T> {
// SAFETY: Safe because we cannot have overlapping mutable borrows
let slot = unsafe { &*self.inner.get() };
@@ -125,7 +125,7 @@ impl<T> OnceCell<T> {
/// assert_eq!(value, &92);
/// ```
#[inline]
#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
pub fn get_or_init<F>(&self, f: F) -> &T
where
F: FnOnce() -> T,
@@ -206,7 +206,7 @@ impl<T> OnceCell<T> {
/// assert_eq!(cell.into_inner(), Some("hello".to_string()));
/// ```
#[inline]
#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
pub fn into_inner(self) -> Option<T> {
// Because `into_inner` takes `self` by value, the compiler statically verifies
// that it is not currently borrowed. So it is safe to move out `Option<T>`.
@@ -233,21 +233,21 @@ impl<T> OnceCell<T> {
/// assert_eq!(cell.get(), None);
/// ```
#[inline]
#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
pub fn take(&mut self) -> Option<T> {
mem::take(self).into_inner()
}
}

#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
impl<T> Default for OnceCell<T> {
#[inline]
fn default() -> Self {
Self::new()
}
}

#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
impl<T: fmt::Debug> fmt::Debug for OnceCell<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.get() {
@@ -257,7 +257,7 @@ impl<T: fmt::Debug> fmt::Debug for OnceCell<T> {
}
}

#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
impl<T: Clone> Clone for OnceCell<T> {
#[inline]
fn clone(&self) -> OnceCell<T> {
@@ -272,18 +272,18 @@ impl<T: Clone> Clone for OnceCell<T> {
}
}

#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
impl<T: PartialEq> PartialEq for OnceCell<T> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.get() == other.get()
}
}

#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
impl<T: Eq> Eq for OnceCell<T> {}

#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
impl<T> const From<T> for OnceCell<T> {
/// Creates a new `OnceCell<T>` which already contains the given `value`.
@@ -294,5 +294,5 @@ impl<T> const From<T> for OnceCell<T> {
}

// Just like for `Cell<T>` this isn't needed, but results in nicer error messages.
#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "once_cell", since = "1.70.0")]
impl<T> !Sync for OnceCell<T> {}
2 changes: 1 addition & 1 deletion library/core/src/iter/adapters/chain.rs
Original file line number Diff line number Diff line change
@@ -273,7 +273,7 @@ where
{
}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<A: Default, B: Default> Default for Chain<A, B> {
/// Creates a `Chain` from the default values for `A` and `B`.
///
2 changes: 1 addition & 1 deletion library/core/src/iter/adapters/cloned.rs
Original file line number Diff line number Diff line change
@@ -154,7 +154,7 @@ where
}
}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<I: Default> Default for Cloned<I> {
/// Creates a `Cloned` iterator from the default value of `I`
/// ```
2 changes: 1 addition & 1 deletion library/core/src/iter/adapters/copied.rs
Original file line number Diff line number Diff line change
@@ -242,7 +242,7 @@ where
}
}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<I: Default> Default for Copied<I> {
/// Creates a `Copied` iterator from the default value of `I`
/// ```
2 changes: 1 addition & 1 deletion library/core/src/iter/adapters/enumerate.rs
Original file line number Diff line number Diff line change
@@ -263,7 +263,7 @@ where
#[unstable(issue = "none", feature = "inplace_iteration")]
unsafe impl<I: InPlaceIterable> InPlaceIterable for Enumerate<I> {}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<I: Default> Default for Enumerate<I> {
/// Creates an `Enumerate` iterator from the default value of `I`
/// ```
2 changes: 1 addition & 1 deletion library/core/src/iter/adapters/flatten.rs
Original file line number Diff line number Diff line change
@@ -303,7 +303,7 @@ where
{
}

#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")]
#[stable(feature = "default_iters", since = "1.70.0")]
impl<I> Default for Flatten<I>
where
I: Default + Iterator<Item: IntoIterator>,
Loading