Skip to content

Commit 9e31617

Browse files
committed
Auto merge of rust-lang#143556 - jhpratt:rollup-nid39y2, r=jhpratt
Rollup of 9 pull requests Successful merges: - rust-lang#143206 (Align attr fixes) - rust-lang#143236 (Stabilize `mixed_integer_ops_unsigned_sub`) - rust-lang#143344 (Port `#[path]` to the new attribute parsing infrastructure ) - rust-lang#143359 (Link to 2024 edition page for `!` fallback changes) - rust-lang#143456 (mbe: Change `unused_macro_rules` to a `DenseBitSet`) - rust-lang#143529 (Renamed retain_mut to retain on LinkedList as mentioned in the ACP) - rust-lang#143535 (Remove duplicate word) - rust-lang#143544 (compiler: rename BareFn to FnPtr) - rust-lang#143552 (lib: more eagerly return `self.len()` from `ceil_char_boundary`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents cb6f505 + aa1b279 commit 9e31617

File tree

4 files changed

+14
-51
lines changed

4 files changed

+14
-51
lines changed

alloc/src/collections/linked_list.rs

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ impl<T, A: Allocator> LinkedList<T, A> {
10311031

10321032
/// Retains only the elements specified by the predicate.
10331033
///
1034-
/// In other words, remove all elements `e` for which `f(&e)` returns false.
1034+
/// In other words, remove all elements `e` for which `f(&mut e)` returns false.
10351035
/// This method operates in place, visiting each element exactly once in the
10361036
/// original order, and preserves the order of the retained elements.
10371037
///
@@ -1047,7 +1047,7 @@ impl<T, A: Allocator> LinkedList<T, A> {
10471047
/// d.push_front(2);
10481048
/// d.push_front(3);
10491049
///
1050-
/// d.retain(|&x| x % 2 == 0);
1050+
/// d.retain(|&mut x| x % 2 == 0);
10511051
///
10521052
/// assert_eq!(d.pop_front(), Some(2));
10531053
/// assert_eq!(d.pop_front(), None);
@@ -1074,41 +1074,6 @@ impl<T, A: Allocator> LinkedList<T, A> {
10741074
/// ```
10751075
#[unstable(feature = "linked_list_retain", issue = "114135")]
10761076
pub fn retain<F>(&mut self, mut f: F)
1077-
where
1078-
F: FnMut(&T) -> bool,
1079-
{
1080-
self.retain_mut(|elem| f(elem));
1081-
}
1082-
1083-
/// Retains only the elements specified by the predicate.
1084-
///
1085-
/// In other words, remove all elements `e` for which `f(&mut e)` returns false.
1086-
/// This method operates in place, visiting each element exactly once in the
1087-
/// original order, and preserves the order of the retained elements.
1088-
///
1089-
/// # Examples
1090-
///
1091-
/// ```
1092-
/// #![feature(linked_list_retain)]
1093-
/// use std::collections::LinkedList;
1094-
///
1095-
/// let mut d = LinkedList::new();
1096-
///
1097-
/// d.push_front(1);
1098-
/// d.push_front(2);
1099-
/// d.push_front(3);
1100-
///
1101-
/// d.retain_mut(|x| if *x % 2 == 0 {
1102-
/// *x += 1;
1103-
/// true
1104-
/// } else {
1105-
/// false
1106-
/// });
1107-
/// assert_eq!(d.pop_front(), Some(3));
1108-
/// assert_eq!(d.pop_front(), None);
1109-
/// ```
1110-
#[unstable(feature = "linked_list_retain", issue = "114135")]
1111-
pub fn retain_mut<F>(&mut self, mut f: F)
11121077
where
11131078
F: FnMut(&mut T) -> bool,
11141079
{

core/src/num/uint_macros.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -786,12 +786,12 @@ macro_rules! uint_impl {
786786
/// # Examples
787787
///
788788
/// ```
789-
/// #![feature(mixed_integer_ops_unsigned_sub)]
790789
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".checked_sub_signed(2), None);")]
791790
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".checked_sub_signed(-2), Some(3));")]
792791
#[doc = concat!("assert_eq!((", stringify!($SelfT), "::MAX - 2).checked_sub_signed(-4), None);")]
793792
/// ```
794-
#[unstable(feature = "mixed_integer_ops_unsigned_sub", issue = "126043")]
793+
#[stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")]
794+
#[rustc_const_stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")]
795795
#[must_use = "this returns the result of the operation, \
796796
without modifying the original"]
797797
#[inline]
@@ -1933,12 +1933,12 @@ macro_rules! uint_impl {
19331933
/// # Examples
19341934
///
19351935
/// ```
1936-
/// #![feature(mixed_integer_ops_unsigned_sub)]
19371936
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".saturating_sub_signed(2), 0);")]
19381937
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".saturating_sub_signed(-2), 3);")]
19391938
#[doc = concat!("assert_eq!((", stringify!($SelfT), "::MAX - 2).saturating_sub_signed(-4), ", stringify!($SelfT), "::MAX);")]
19401939
/// ```
1941-
#[unstable(feature = "mixed_integer_ops_unsigned_sub", issue = "126043")]
1940+
#[stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")]
1941+
#[rustc_const_stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")]
19421942
#[must_use = "this returns the result of the operation, \
19431943
without modifying the original"]
19441944
#[inline]
@@ -2081,12 +2081,12 @@ macro_rules! uint_impl {
20812081
/// # Examples
20822082
///
20832083
/// ```
2084-
/// #![feature(mixed_integer_ops_unsigned_sub)]
20852084
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".wrapping_sub_signed(2), ", stringify!($SelfT), "::MAX);")]
20862085
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".wrapping_sub_signed(-2), 3);")]
20872086
#[doc = concat!("assert_eq!((", stringify!($SelfT), "::MAX - 2).wrapping_sub_signed(-4), 1);")]
20882087
/// ```
2089-
#[unstable(feature = "mixed_integer_ops_unsigned_sub", issue = "126043")]
2088+
#[stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")]
2089+
#[rustc_const_stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")]
20902090
#[must_use = "this returns the result of the operation, \
20912091
without modifying the original"]
20922092
#[inline]
@@ -2540,12 +2540,12 @@ macro_rules! uint_impl {
25402540
/// # Examples
25412541
///
25422542
/// ```
2543-
/// #![feature(mixed_integer_ops_unsigned_sub)]
25442543
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".overflowing_sub_signed(2), (", stringify!($SelfT), "::MAX, true));")]
25452544
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".overflowing_sub_signed(-2), (3, false));")]
25462545
#[doc = concat!("assert_eq!((", stringify!($SelfT), "::MAX - 2).overflowing_sub_signed(-4), (1, true));")]
25472546
/// ```
2548-
#[unstable(feature = "mixed_integer_ops_unsigned_sub", issue = "126043")]
2547+
#[stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")]
2548+
#[rustc_const_stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")]
25492549
#[must_use = "this returns the result of the operation, \
25502550
without modifying the original"]
25512551
#[inline]

core/src/primitive_docs.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,14 +304,12 @@ mod prim_bool {}
304304
/// This is what is known as "never type fallback".
305305
///
306306
/// Historically, the fallback type was [`()`], causing confusing behavior where `!` spontaneously
307-
/// coerced to `()`, even when it would not infer `()` without the fallback. There are plans to
308-
/// change it in the [2024 edition] (and possibly in all editions on a later date); see
309-
/// [Tracking Issue for making `!` fall back to `!`][fallback-ti].
307+
/// coerced to `()`, even when it would not infer `()` without the fallback. The fallback was changed
308+
/// to `!` in the [2024 edition], and will be changed in all editions at a later date.
310309
///
311310
/// [coercion site]: <https://doc.rust-lang.org/reference/type-coercions.html#coercion-sites>
312311
/// [`()`]: prim@unit
313-
/// [fallback-ti]: <https://github.com/rust-lang/rust/issues/123748>
314-
/// [2024 edition]: <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/index.html>
312+
/// [2024 edition]: <https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html>
315313
///
316314
#[unstable(feature = "never_type", issue = "35121")]
317315
mod prim_never {}

core/src/str/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ impl str {
446446
#[unstable(feature = "round_char_boundary", issue = "93743")]
447447
#[inline]
448448
pub fn ceil_char_boundary(&self, index: usize) -> usize {
449-
if index > self.len() {
449+
if index >= self.len() {
450450
self.len()
451451
} else {
452452
let upper_bound = Ord::min(index + 4, self.len());

0 commit comments

Comments
 (0)