Skip to content

Commit ac2bb56

Browse files
authored
Merge branch 'rust-lang:master' into master
2 parents b0a77eb + 87dfe34 commit ac2bb56

File tree

5 files changed

+53
-49
lines changed

5 files changed

+53
-49
lines changed

core/src/num/int_macros.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,17 +1849,17 @@ macro_rules! int_impl {
18491849
#[doc = concat!("let a: ", stringify!($SelfT)," = 8;")]
18501850
/// let b = 3;
18511851
///
1852-
/// assert_eq!(a.div_floor(b), 2);
1853-
/// assert_eq!(a.div_floor(-b), -3);
1854-
/// assert_eq!((-a).div_floor(b), -3);
1855-
/// assert_eq!((-a).div_floor(-b), 2);
1852+
/// assert_eq!(a.unstable_div_floor(b), 2);
1853+
/// assert_eq!(a.unstable_div_floor(-b), -3);
1854+
/// assert_eq!((-a).unstable_div_floor(b), -3);
1855+
/// assert_eq!((-a).unstable_div_floor(-b), 2);
18561856
/// ```
18571857
#[unstable(feature = "int_roundings", issue = "88581")]
18581858
#[must_use = "this returns the result of the operation, \
18591859
without modifying the original"]
18601860
#[inline]
18611861
#[rustc_inherit_overflow_checks]
1862-
pub const fn div_floor(self, rhs: Self) -> Self {
1862+
pub const fn unstable_div_floor(self, rhs: Self) -> Self {
18631863
let d = self / rhs;
18641864
let r = self % rhs;
18651865
if (r > 0 && rhs < 0) || (r < 0 && rhs > 0) {
@@ -1884,17 +1884,17 @@ macro_rules! int_impl {
18841884
#[doc = concat!("let a: ", stringify!($SelfT)," = 8;")]
18851885
/// let b = 3;
18861886
///
1887-
/// assert_eq!(a.div_ceil(b), 3);
1888-
/// assert_eq!(a.div_ceil(-b), -2);
1889-
/// assert_eq!((-a).div_ceil(b), -2);
1890-
/// assert_eq!((-a).div_ceil(-b), 3);
1887+
/// assert_eq!(a.unstable_div_ceil(b), 3);
1888+
/// assert_eq!(a.unstable_div_ceil(-b), -2);
1889+
/// assert_eq!((-a).unstable_div_ceil(b), -2);
1890+
/// assert_eq!((-a).unstable_div_ceil(-b), 3);
18911891
/// ```
18921892
#[unstable(feature = "int_roundings", issue = "88581")]
18931893
#[must_use = "this returns the result of the operation, \
18941894
without modifying the original"]
18951895
#[inline]
18961896
#[rustc_inherit_overflow_checks]
1897-
pub const fn div_ceil(self, rhs: Self) -> Self {
1897+
pub const fn unstable_div_ceil(self, rhs: Self) -> Self {
18981898
let d = self / rhs;
18991899
let r = self % rhs;
19001900
if (r > 0 && rhs > 0) || (r < 0 && rhs < 0) {
@@ -1919,21 +1919,21 @@ macro_rules! int_impl {
19191919
///
19201920
/// ```
19211921
/// #![feature(int_roundings)]
1922-
#[doc = concat!("assert_eq!(16_", stringify!($SelfT), ".next_multiple_of(8), 16);")]
1923-
#[doc = concat!("assert_eq!(23_", stringify!($SelfT), ".next_multiple_of(8), 24);")]
1924-
#[doc = concat!("assert_eq!(16_", stringify!($SelfT), ".next_multiple_of(-8), 16);")]
1925-
#[doc = concat!("assert_eq!(23_", stringify!($SelfT), ".next_multiple_of(-8), 16);")]
1926-
#[doc = concat!("assert_eq!((-16_", stringify!($SelfT), ").next_multiple_of(8), -16);")]
1927-
#[doc = concat!("assert_eq!((-23_", stringify!($SelfT), ").next_multiple_of(8), -16);")]
1928-
#[doc = concat!("assert_eq!((-16_", stringify!($SelfT), ").next_multiple_of(-8), -16);")]
1929-
#[doc = concat!("assert_eq!((-23_", stringify!($SelfT), ").next_multiple_of(-8), -24);")]
1922+
#[doc = concat!("assert_eq!(16_", stringify!($SelfT), ".unstable_next_multiple_of(8), 16);")]
1923+
#[doc = concat!("assert_eq!(23_", stringify!($SelfT), ".unstable_next_multiple_of(8), 24);")]
1924+
#[doc = concat!("assert_eq!(16_", stringify!($SelfT), ".unstable_next_multiple_of(-8), 16);")]
1925+
#[doc = concat!("assert_eq!(23_", stringify!($SelfT), ".unstable_next_multiple_of(-8), 16);")]
1926+
#[doc = concat!("assert_eq!((-16_", stringify!($SelfT), ").unstable_next_multiple_of(8), -16);")]
1927+
#[doc = concat!("assert_eq!((-23_", stringify!($SelfT), ").unstable_next_multiple_of(8), -16);")]
1928+
#[doc = concat!("assert_eq!((-16_", stringify!($SelfT), ").unstable_next_multiple_of(-8), -16);")]
1929+
#[doc = concat!("assert_eq!((-23_", stringify!($SelfT), ").unstable_next_multiple_of(-8), -24);")]
19301930
/// ```
19311931
#[unstable(feature = "int_roundings", issue = "88581")]
19321932
#[must_use = "this returns the result of the operation, \
19331933
without modifying the original"]
19341934
#[inline]
19351935
#[rustc_inherit_overflow_checks]
1936-
pub const fn next_multiple_of(self, rhs: Self) -> Self {
1936+
pub const fn unstable_next_multiple_of(self, rhs: Self) -> Self {
19371937
// This would otherwise fail when calculating `r` when self == T::MIN.
19381938
if rhs == -1 {
19391939
return self;

core/src/num/uint_macros.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,12 +1859,12 @@ macro_rules! uint_impl {
18591859
///
18601860
/// ```
18611861
/// #![feature(int_roundings)]
1862-
#[doc = concat!("assert_eq!(7_", stringify!($SelfT), ".div_floor(4), 1);")]
1862+
#[doc = concat!("assert_eq!(7_", stringify!($SelfT), ".unstable_div_floor(4), 1);")]
18631863
/// ```
18641864
#[unstable(feature = "int_roundings", issue = "88581")]
18651865
#[inline(always)]
18661866
#[rustc_inherit_overflow_checks]
1867-
pub const fn div_floor(self, rhs: Self) -> Self {
1867+
pub const fn unstable_div_floor(self, rhs: Self) -> Self {
18681868
self / rhs
18691869
}
18701870

@@ -1880,12 +1880,12 @@ macro_rules! uint_impl {
18801880
///
18811881
/// ```
18821882
/// #![feature(int_roundings)]
1883-
#[doc = concat!("assert_eq!(7_", stringify!($SelfT), ".div_ceil(4), 2);")]
1883+
#[doc = concat!("assert_eq!(7_", stringify!($SelfT), ".unstable_div_ceil(4), 2);")]
18841884
/// ```
18851885
#[unstable(feature = "int_roundings", issue = "88581")]
18861886
#[inline]
18871887
#[rustc_inherit_overflow_checks]
1888-
pub const fn div_ceil(self, rhs: Self) -> Self {
1888+
pub const fn unstable_div_ceil(self, rhs: Self) -> Self {
18891889
let d = self / rhs;
18901890
let r = self % rhs;
18911891
if r > 0 && rhs > 0 {
@@ -1908,15 +1908,15 @@ macro_rules! uint_impl {
19081908
///
19091909
/// ```
19101910
/// #![feature(int_roundings)]
1911-
#[doc = concat!("assert_eq!(16_", stringify!($SelfT), ".next_multiple_of(8), 16);")]
1912-
#[doc = concat!("assert_eq!(23_", stringify!($SelfT), ".next_multiple_of(8), 24);")]
1911+
#[doc = concat!("assert_eq!(16_", stringify!($SelfT), ".unstable_next_multiple_of(8), 16);")]
1912+
#[doc = concat!("assert_eq!(23_", stringify!($SelfT), ".unstable_next_multiple_of(8), 24);")]
19131913
/// ```
19141914
#[unstable(feature = "int_roundings", issue = "88581")]
19151915
#[must_use = "this returns the result of the operation, \
19161916
without modifying the original"]
19171917
#[inline]
19181918
#[rustc_inherit_overflow_checks]
1919-
pub const fn next_multiple_of(self, rhs: Self) -> Self {
1919+
pub const fn unstable_next_multiple_of(self, rhs: Self) -> Self {
19201920
match self % rhs {
19211921
0 => self,
19221922
r => self + (rhs - r)

core/tests/num/int_macros.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -294,33 +294,33 @@ macro_rules! int_module {
294294
fn test_div_floor() {
295295
let a: $T = 8;
296296
let b = 3;
297-
assert_eq!(a.div_floor(b), 2);
298-
assert_eq!(a.div_floor(-b), -3);
299-
assert_eq!((-a).div_floor(b), -3);
300-
assert_eq!((-a).div_floor(-b), 2);
297+
assert_eq!(a.unstable_div_floor(b), 2);
298+
assert_eq!(a.unstable_div_floor(-b), -3);
299+
assert_eq!((-a).unstable_div_floor(b), -3);
300+
assert_eq!((-a).unstable_div_floor(-b), 2);
301301
}
302302

303303
#[test]
304304
fn test_div_ceil() {
305305
let a: $T = 8;
306306
let b = 3;
307-
assert_eq!(a.div_ceil(b), 3);
308-
assert_eq!(a.div_ceil(-b), -2);
309-
assert_eq!((-a).div_ceil(b), -2);
310-
assert_eq!((-a).div_ceil(-b), 3);
307+
assert_eq!(a.unstable_div_ceil(b), 3);
308+
assert_eq!(a.unstable_div_ceil(-b), -2);
309+
assert_eq!((-a).unstable_div_ceil(b), -2);
310+
assert_eq!((-a).unstable_div_ceil(-b), 3);
311311
}
312312

313313
#[test]
314314
fn test_next_multiple_of() {
315-
assert_eq!((16 as $T).next_multiple_of(8), 16);
316-
assert_eq!((23 as $T).next_multiple_of(8), 24);
317-
assert_eq!((16 as $T).next_multiple_of(-8), 16);
318-
assert_eq!((23 as $T).next_multiple_of(-8), 16);
319-
assert_eq!((-16 as $T).next_multiple_of(8), -16);
320-
assert_eq!((-23 as $T).next_multiple_of(8), -16);
321-
assert_eq!((-16 as $T).next_multiple_of(-8), -16);
322-
assert_eq!((-23 as $T).next_multiple_of(-8), -24);
323-
assert_eq!(MIN.next_multiple_of(-1), MIN);
315+
assert_eq!((16 as $T).unstable_next_multiple_of(8), 16);
316+
assert_eq!((23 as $T).unstable_next_multiple_of(8), 24);
317+
assert_eq!((16 as $T).unstable_next_multiple_of(-8), 16);
318+
assert_eq!((23 as $T).unstable_next_multiple_of(-8), 16);
319+
assert_eq!((-16 as $T).unstable_next_multiple_of(8), -16);
320+
assert_eq!((-23 as $T).unstable_next_multiple_of(8), -16);
321+
assert_eq!((-16 as $T).unstable_next_multiple_of(-8), -16);
322+
assert_eq!((-23 as $T).unstable_next_multiple_of(-8), -24);
323+
assert_eq!(MIN.unstable_next_multiple_of(-1), MIN);
324324
}
325325

326326
#[test]

core/tests/num/uint_macros.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,19 +208,19 @@ macro_rules! uint_module {
208208

209209
#[test]
210210
fn test_div_floor() {
211-
assert_eq!((8 as $T).div_floor(3), 2);
211+
assert_eq!((8 as $T).unstable_div_floor(3), 2);
212212
}
213213

214214
#[test]
215215
fn test_div_ceil() {
216-
assert_eq!((8 as $T).div_ceil(3), 3);
216+
assert_eq!((8 as $T).unstable_div_ceil(3), 3);
217217
}
218218

219219
#[test]
220220
fn test_next_multiple_of() {
221-
assert_eq!((16 as $T).next_multiple_of(8), 16);
222-
assert_eq!((23 as $T).next_multiple_of(8), 24);
223-
assert_eq!(MAX.next_multiple_of(1), MAX);
221+
assert_eq!((16 as $T).unstable_next_multiple_of(8), 16);
222+
assert_eq!((23 as $T).unstable_next_multiple_of(8), 24);
223+
assert_eq!(MAX.unstable_next_multiple_of(1), MAX);
224224
}
225225

226226
#[test]

std/src/sync/mpsc/shared.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,11 @@ impl<T> Packet<T> {
248248
// Returns true if blocking should proceed.
249249
fn decrement(&self, token: SignalToken) -> StartResult {
250250
unsafe {
251-
assert_eq!(self.to_wake.load(Ordering::SeqCst), 0);
251+
assert_eq!(
252+
self.to_wake.load(Ordering::SeqCst),
253+
0,
254+
"This is a known bug in the Rust standard library. See https://github.com/rust-lang/rust/issues/39364"
255+
);
252256
let ptr = token.cast_to_usize();
253257
self.to_wake.store(ptr, Ordering::SeqCst);
254258

0 commit comments

Comments
 (0)