Skip to content

Commit 215bf3a

Browse files
committed
Auto merge of #53056 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests Successful merges: - #51919 (Provide `{to,from}_{ne,le,be}_bytes` functions on integers) - #52940 (Align 6-week cycle check with beta promotion instead of stable release.) - #52968 (App-lint-cability) - #52969 (rustbuild: fix local_rebuild) - #52995 (Remove unnecessary local in await! generator) - #52996 (RELEASES.md: fix the `hash_map::Entry::or_default` link) - #53001 (privacy: Fix an ICE in `path_is_private_type`) - #53003 (Stabilize --color and --error-format options in rustdoc) - #53022 (volatile operations docs: clarify that this does not help wrt. concurrency) - #53024 (Specify reentrancy gurantees of `Once::call_once`) - #53041 (Fix invalid code css rule) - #53047 (Make entire row of doc search results clickable) - #53050 (Make left column of rustdoc search results narrower) - #53062 (Remove redundant field names in structs)
2 parents 579adf8 + 396dda0 commit 215bf3a

File tree

28 files changed

+261
-107
lines changed

28 files changed

+261
-107
lines changed

RELEASES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Compatibility Notes
144144
[`alloc::handle_alloc_error`]: https://doc.rust-lang.org/std/alloc/fn.handle_alloc_error.html
145145
[`btree_map::Entry::or_default`]: https://doc.rust-lang.org/std/collections/btree_map/enum.Entry.html#method.or_default
146146
[`fmt::Alignment`]: https://doc.rust-lang.org/std/fmt/enum.Alignment.html
147-
[`hash_map::Entry::or_default`]: https://doc.rust-lang.org/std/collections/btree_map/enum.Entry.html#method.or_default
147+
[`hash_map::Entry::or_default`]: https://doc.rust-lang.org/std/collections/hash_map/enum.Entry.html#method.or_default
148148
[`iter::repeat_with`]: https://doc.rust-lang.org/std/iter/fn.repeat_with.html
149149
[`num::NonZeroUsize`]: https://doc.rust-lang.org/std/num/struct.NonZeroUsize.html
150150
[`num::NonZeroU128`]: https://doc.rust-lang.org/std/num/struct.NonZeroU128.html

src/bootstrap/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ impl<'a> Builder<'a> {
777777
// compiler, but for tools we just use the precompiled libraries that
778778
// we've downloaded
779779
let use_snapshot = mode == Mode::ToolBootstrap;
780-
assert!(!use_snapshot || stage == 0);
780+
assert!(!use_snapshot || stage == 0 || self.local_rebuild);
781781

782782
let maybe_sysroot = self.sysroot(compiler);
783783
let sysroot = if use_snapshot {

src/ci/docker/x86_64-gnu-tools/checktools.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ TOOLSTATE_FILE="$(realpath $2)"
1717
OS="$3"
1818
COMMIT="$(git rev-parse HEAD)"
1919
CHANGED_FILES="$(git diff --name-status HEAD HEAD^)"
20-
SIX_WEEK_CYCLE="$(( ($(date +%s) / 604800 - 3) % 6 ))"
21-
# ^ 1970 Jan 1st is a Thursday, and our release dates are also on Thursdays,
22-
# thus we could divide by 604800 (7 days in seconds) directly.
20+
SIX_WEEK_CYCLE="$(( ($(date +%s) / 86400 - 20) % 42 ))"
21+
# ^ Number of days after the last promotion of beta.
22+
# Its value is 41 on the Tuesday where "Promote master to beta (T-2)" happens.
23+
# The Wednesday after this has value 0.
24+
# We track this value to prevent regressing tools in the last week of the 6-week cycle.
2325

2426
touch "$TOOLSTATE_FILE"
2527

@@ -98,7 +100,7 @@ change_toolstate() {
98100
if python2.7 "$CHECK_NOT" "$OS" "$TOOLSTATE_FILE" "_data/latest.json" changed; then
99101
echo 'Toolstate is not changed. Not updating.'
100102
else
101-
if [ $SIX_WEEK_CYCLE -eq 5 ]; then
103+
if [ $SIX_WEEK_CYCLE -ge 35 ]; then
102104
python2.7 "$CHECK_NOT" "$OS" "$TOOLSTATE_FILE" "_data/latest.json" regressed
103105
fi
104106
sed -i "1 a\\

src/libcore/cell.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
12581258
let RefMut { value, borrow } = orig;
12591259
RefMut {
12601260
value: f(value),
1261-
borrow: borrow,
1261+
borrow,
12621262
}
12631263
}
12641264

@@ -1324,7 +1324,7 @@ impl<'b> BorrowRefMut<'b> {
13241324
match borrow.get() {
13251325
UNUSED => {
13261326
borrow.set(UNUSED - 1);
1327-
Some(BorrowRefMut { borrow: borrow })
1327+
Some(BorrowRefMut { borrow })
13281328
},
13291329
_ => None,
13301330
}
@@ -1467,7 +1467,7 @@ impl<T> UnsafeCell<T> {
14671467
#[stable(feature = "rust1", since = "1.0.0")]
14681468
#[inline]
14691469
pub const fn new(value: T) -> UnsafeCell<T> {
1470-
UnsafeCell { value: value }
1470+
UnsafeCell { value }
14711471
}
14721472

14731473
/// Unwraps the value.

src/libcore/iter/iterator.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ pub trait Iterator {
507507
fn map<B, F>(self, f: F) -> Map<Self, F> where
508508
Self: Sized, F: FnMut(Self::Item) -> B,
509509
{
510-
Map{iter: self, f: f}
510+
Map { iter: self, f }
511511
}
512512

513513
/// Calls a closure on each element of an iterator.
@@ -618,7 +618,7 @@ pub trait Iterator {
618618
fn filter<P>(self, predicate: P) -> Filter<Self, P> where
619619
Self: Sized, P: FnMut(&Self::Item) -> bool,
620620
{
621-
Filter{iter: self, predicate: predicate}
621+
Filter {iter: self, predicate }
622622
}
623623

624624
/// Creates an iterator that both filters and maps.
@@ -675,7 +675,7 @@ pub trait Iterator {
675675
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where
676676
Self: Sized, F: FnMut(Self::Item) -> Option<B>,
677677
{
678-
FilterMap { iter: self, f: f }
678+
FilterMap { iter: self, f }
679679
}
680680

681681
/// Creates an iterator which gives the current iteration count as well as
@@ -828,7 +828,7 @@ pub trait Iterator {
828828
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
829829
Self: Sized, P: FnMut(&Self::Item) -> bool,
830830
{
831-
SkipWhile{iter: self, flag: false, predicate: predicate}
831+
SkipWhile { iter: self, flag: false, predicate }
832832
}
833833

834834
/// Creates an iterator that yields elements based on a predicate.
@@ -908,7 +908,7 @@ pub trait Iterator {
908908
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where
909909
Self: Sized, P: FnMut(&Self::Item) -> bool,
910910
{
911-
TakeWhile{iter: self, flag: false, predicate: predicate}
911+
TakeWhile { iter: self, flag: false, predicate }
912912
}
913913

914914
/// Creates an iterator that skips the first `n` elements.
@@ -930,7 +930,7 @@ pub trait Iterator {
930930
#[inline]
931931
#[stable(feature = "rust1", since = "1.0.0")]
932932
fn skip(self, n: usize) -> Skip<Self> where Self: Sized {
933-
Skip{iter: self, n: n}
933+
Skip { iter: self, n }
934934
}
935935

936936
/// Creates an iterator that yields its first `n` elements.
@@ -962,7 +962,7 @@ pub trait Iterator {
962962
#[inline]
963963
#[stable(feature = "rust1", since = "1.0.0")]
964964
fn take(self, n: usize) -> Take<Self> where Self: Sized, {
965-
Take{iter: self, n: n}
965+
Take { iter: self, n }
966966
}
967967

968968
/// An iterator adaptor similar to [`fold`] that holds internal state and
@@ -1007,7 +1007,7 @@ pub trait Iterator {
10071007
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
10081008
where Self: Sized, F: FnMut(&mut St, Self::Item) -> Option<B>,
10091009
{
1010-
Scan{iter: self, f: f, state: initial_state}
1010+
Scan { iter: self, f, state: initial_state }
10111011
}
10121012

10131013
/// Creates an iterator that works like map, but flattens nested structure.
@@ -1256,7 +1256,7 @@ pub trait Iterator {
12561256
fn inspect<F>(self, f: F) -> Inspect<Self, F> where
12571257
Self: Sized, F: FnMut(&Self::Item),
12581258
{
1259-
Inspect{iter: self, f: f}
1259+
Inspect { iter: self, f }
12601260
}
12611261

12621262
/// Borrows an iterator, rather than consuming it.

src/libcore/num/dec2flt/parse.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub struct Decimal<'a> {
4040

4141
impl<'a> Decimal<'a> {
4242
pub fn new(integral: &'a [u8], fractional: &'a [u8], exp: i64) -> Decimal<'a> {
43-
Decimal { integral: integral, fractional: fractional, exp: exp }
43+
Decimal { integral, fractional, exp }
4444
}
4545
}
4646

src/libcore/num/dec2flt/rawfp.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub struct Unpacked {
4545

4646
impl Unpacked {
4747
pub fn new(sig: u64, k: i16) -> Self {
48-
Unpacked { sig: sig, k: k }
48+
Unpacked { sig, k }
4949
}
5050
}
5151

@@ -317,13 +317,13 @@ pub fn big_to_fp(f: &Big) -> Fp {
317317
// We cut off all bits prior to the index `start`, i.e., we effectively right-shift by
318318
// an amount of `start`, so this is also the exponent we need.
319319
let e = start as i16;
320-
let rounded_down = Fp { f: leading, e: e }.normalize();
320+
let rounded_down = Fp { f: leading, e }.normalize();
321321
// Round (half-to-even) depending on the truncated bits.
322322
match num::compare_with_half_ulp(f, start) {
323323
Less => rounded_down,
324324
Equal if leading % 2 == 0 => rounded_down,
325325
Equal | Greater => match leading.checked_add(1) {
326-
Some(f) => Fp { f: f, e: e }.normalize(),
326+
Some(f) => Fp { f, e }.normalize(),
327327
None => Fp { f: 1 << 63, e: e + 1 },
328328
}
329329
}

src/libcore/num/diy_float.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl Fp {
4242
let tmp = (bd >> 32) + (ad & MASK) + (bc & MASK) + (1 << 31) /* round */;
4343
let f = ac + (ad >> 32) + (bc >> 32) + (tmp >> 32);
4444
let e = self.e + other.e + 64;
45-
Fp { f: f, e: e }
45+
Fp { f, e }
4646
}
4747

4848
/// Normalizes itself so that the resulting mantissa is at least `2^63`.
@@ -74,7 +74,7 @@ impl Fp {
7474
e -= 1;
7575
}
7676
debug_assert!(f >= (1 >> 63));
77-
Fp { f: f, e: e }
77+
Fp { f, e }
7878
}
7979

8080
/// Normalizes itself to have the shared exponent.

src/libcore/num/flt2dec/decoder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ pub fn decode<T: DecodableFloat>(v: T) -> (/*negative?*/ bool, FullDecoded) {
7777
// neighbors: (mant - 2, exp) -- (mant, exp) -- (mant + 2, exp)
7878
// Float::integer_decode always preserves the exponent,
7979
// so the mantissa is scaled for subnormals.
80-
FullDecoded::Finite(Decoded { mant: mant, minus: 1, plus: 1,
81-
exp: exp, inclusive: even })
80+
FullDecoded::Finite(Decoded { mant, minus: 1, plus: 1,
81+
exp, inclusive: even })
8282
}
8383
FpCategory::Normal => {
8484
let minnorm = <T as DecodableFloat>::min_pos_norm_value().integer_decode();

src/libcore/num/flt2dec/mod.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -424,20 +424,20 @@ pub fn to_shortest_str<'a, T, F>(mut format_shortest: F, v: T,
424424
match full_decoded {
425425
FullDecoded::Nan => {
426426
parts[0] = Part::Copy(b"NaN");
427-
Formatted { sign: sign, parts: &parts[..1] }
427+
Formatted { sign, parts: &parts[..1] }
428428
}
429429
FullDecoded::Infinite => {
430430
parts[0] = Part::Copy(b"inf");
431-
Formatted { sign: sign, parts: &parts[..1] }
431+
Formatted { sign, parts: &parts[..1] }
432432
}
433433
FullDecoded::Zero => {
434434
if frac_digits > 0 { // [0.][0000]
435435
parts[0] = Part::Copy(b"0.");
436436
parts[1] = Part::Zero(frac_digits);
437-
Formatted { sign: sign, parts: &parts[..2] }
437+
Formatted { sign, parts: &parts[..2] }
438438
} else {
439439
parts[0] = Part::Copy(b"0");
440-
Formatted { sign: sign, parts: &parts[..1] }
440+
Formatted { sign, parts: &parts[..1] }
441441
}
442442
}
443443
FullDecoded::Finite(ref decoded) => {
@@ -480,19 +480,19 @@ pub fn to_shortest_exp_str<'a, T, F>(mut format_shortest: F, v: T,
480480
match full_decoded {
481481
FullDecoded::Nan => {
482482
parts[0] = Part::Copy(b"NaN");
483-
Formatted { sign: sign, parts: &parts[..1] }
483+
Formatted { sign, parts: &parts[..1] }
484484
}
485485
FullDecoded::Infinite => {
486486
parts[0] = Part::Copy(b"inf");
487-
Formatted { sign: sign, parts: &parts[..1] }
487+
Formatted { sign, parts: &parts[..1] }
488488
}
489489
FullDecoded::Zero => {
490490
parts[0] = if dec_bounds.0 <= 0 && 0 < dec_bounds.1 {
491491
Part::Copy(b"0")
492492
} else {
493493
Part::Copy(if upper { b"0E0" } else { b"0e0" })
494494
};
495-
Formatted { sign: sign, parts: &parts[..1] }
495+
Formatted { sign, parts: &parts[..1] }
496496
}
497497
FullDecoded::Finite(ref decoded) => {
498498
let (len, exp) = format_shortest(decoded, buf);
@@ -502,7 +502,7 @@ pub fn to_shortest_exp_str<'a, T, F>(mut format_shortest: F, v: T,
502502
} else {
503503
digits_to_exp_str(&buf[..len], exp, 0, upper, parts)
504504
};
505-
Formatted { sign: sign, parts: parts }
505+
Formatted { sign, parts }
506506
}
507507
}
508508
}
@@ -558,21 +558,21 @@ pub fn to_exact_exp_str<'a, T, F>(mut format_exact: F, v: T,
558558
match full_decoded {
559559
FullDecoded::Nan => {
560560
parts[0] = Part::Copy(b"NaN");
561-
Formatted { sign: sign, parts: &parts[..1] }
561+
Formatted { sign, parts: &parts[..1] }
562562
}
563563
FullDecoded::Infinite => {
564564
parts[0] = Part::Copy(b"inf");
565-
Formatted { sign: sign, parts: &parts[..1] }
565+
Formatted { sign, parts: &parts[..1] }
566566
}
567567
FullDecoded::Zero => {
568568
if ndigits > 1 { // [0.][0000][e0]
569569
parts[0] = Part::Copy(b"0.");
570570
parts[1] = Part::Zero(ndigits - 1);
571571
parts[2] = Part::Copy(if upper { b"E0" } else { b"e0" });
572-
Formatted { sign: sign, parts: &parts[..3] }
572+
Formatted { sign, parts: &parts[..3] }
573573
} else {
574574
parts[0] = Part::Copy(if upper { b"0E0" } else { b"0e0" });
575-
Formatted { sign: sign, parts: &parts[..1] }
575+
Formatted { sign, parts: &parts[..1] }
576576
}
577577
}
578578
FullDecoded::Finite(ref decoded) => {
@@ -613,20 +613,20 @@ pub fn to_exact_fixed_str<'a, T, F>(mut format_exact: F, v: T,
613613
match full_decoded {
614614
FullDecoded::Nan => {
615615
parts[0] = Part::Copy(b"NaN");
616-
Formatted { sign: sign, parts: &parts[..1] }
616+
Formatted { sign, parts: &parts[..1] }
617617
}
618618
FullDecoded::Infinite => {
619619
parts[0] = Part::Copy(b"inf");
620-
Formatted { sign: sign, parts: &parts[..1] }
620+
Formatted { sign, parts: &parts[..1] }
621621
}
622622
FullDecoded::Zero => {
623623
if frac_digits > 0 { // [0.][0000]
624624
parts[0] = Part::Copy(b"0.");
625625
parts[1] = Part::Zero(frac_digits);
626-
Formatted { sign: sign, parts: &parts[..2] }
626+
Formatted { sign, parts: &parts[..2] }
627627
} else {
628628
parts[0] = Part::Copy(b"0");
629-
Formatted { sign: sign, parts: &parts[..1] }
629+
Formatted { sign, parts: &parts[..1] }
630630
}
631631
}
632632
FullDecoded::Finite(ref decoded) => {
@@ -646,10 +646,10 @@ pub fn to_exact_fixed_str<'a, T, F>(mut format_exact: F, v: T,
646646
if frac_digits > 0 { // [0.][0000]
647647
parts[0] = Part::Copy(b"0.");
648648
parts[1] = Part::Zero(frac_digits);
649-
Formatted { sign: sign, parts: &parts[..2] }
649+
Formatted { sign, parts: &parts[..2] }
650650
} else {
651651
parts[0] = Part::Copy(b"0");
652-
Formatted { sign: sign, parts: &parts[..1] }
652+
Formatted { sign, parts: &parts[..1] }
653653
}
654654
} else {
655655
Formatted { sign,

src/libcore/num/flt2dec/strategy/grisu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ pub fn cached_power(alpha: i16, gamma: i16) -> (i16, Fp) {
129129
let idx = ((gamma as i32) - offset) * range / domain;
130130
let (f, e, k) = CACHED_POW10[idx as usize];
131131
debug_assert!(alpha <= e && e <= gamma);
132-
(k, Fp { f: f, e: e })
132+
(k, Fp { f, e })
133133
}
134134

135135
/// Given `x > 0`, returns `(k, 10^k)` such that `10^k <= x < 10^(k+1)`.

0 commit comments

Comments
 (0)