Skip to content

Commit b818ccc

Browse files
committed
Auto merge of #69746 - Dylan-DPC:rollup-wr6dvdk, r=Dylan-DPC
Rollup of 8 pull requests Successful merges: - #69697 (Add explanation for E0380) - #69698 (Use associated constants of integer types) - #69711 (Update macros.rs: fix documentation typo.) - #69713 (more clippy cleanups) - #69728 (Make link to `std::str` active) - #69732 (Clean E0382 and E0384 explanations) - #69736 (even more clippy cleanups) - #69742 (Fixed a typo) Failed merges: r? @ghost
2 parents 96bb8b3 + 80c8434 commit b818ccc

File tree

57 files changed

+128
-129
lines changed

Some content is hidden

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

57 files changed

+128
-129
lines changed

src/liballoc/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ impl String {
407407
///
408408
/// assert_eq!(s.capacity(), cap);
409409
///
410-
/// // ...but this may make the vector reallocate
410+
/// // ...but this may make the string reallocate
411411
/// s.push('a');
412412
/// ```
413413
#[inline]

src/libcore/str/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
//! String manipulation.
44
//!
5-
//! For more details, see the `std::str` module.
5+
//! For more details, see the [`std::str`] module.
6+
//!
7+
//! [`std::str`]: ../../std/str/index.html
68
79
#![stable(feature = "rust1", since = "1.0.0")]
810

src/librustc/dep_graph/graph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ impl DepGraph {
524524
edge_list_indices.push((start, end));
525525
}
526526

527-
debug_assert!(edge_list_data.len() <= ::std::u32::MAX as usize);
527+
debug_assert!(edge_list_data.len() <= u32::MAX as usize);
528528
debug_assert_eq!(edge_list_data.len(), total_edge_count);
529529

530530
SerializedDepGraph { nodes, fingerprints, edge_list_indices, edge_list_data }

src/librustc/mir/interpret/allocation.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -818,9 +818,9 @@ impl UndefMask {
818818
// First set all bits except the first `bita`,
819819
// then unset the last `64 - bitb` bits.
820820
let range = if bitb == 0 {
821-
u64::max_value() << bita
821+
u64::MAX << bita
822822
} else {
823-
(u64::max_value() << bita) & (u64::max_value() >> (64 - bitb))
823+
(u64::MAX << bita) & (u64::MAX >> (64 - bitb))
824824
};
825825
if new_state {
826826
self.blocks[blocka] |= range;
@@ -832,21 +832,21 @@ impl UndefMask {
832832
// across block boundaries
833833
if new_state {
834834
// Set `bita..64` to `1`.
835-
self.blocks[blocka] |= u64::max_value() << bita;
835+
self.blocks[blocka] |= u64::MAX << bita;
836836
// Set `0..bitb` to `1`.
837837
if bitb != 0 {
838-
self.blocks[blockb] |= u64::max_value() >> (64 - bitb);
838+
self.blocks[blockb] |= u64::MAX >> (64 - bitb);
839839
}
840840
// Fill in all the other blocks (much faster than one bit at a time).
841841
for block in (blocka + 1)..blockb {
842-
self.blocks[block] = u64::max_value();
842+
self.blocks[block] = u64::MAX;
843843
}
844844
} else {
845845
// Set `bita..64` to `0`.
846-
self.blocks[blocka] &= !(u64::max_value() << bita);
846+
self.blocks[blocka] &= !(u64::MAX << bita);
847847
// Set `0..bitb` to `0`.
848848
if bitb != 0 {
849-
self.blocks[blockb] &= !(u64::max_value() >> (64 - bitb));
849+
self.blocks[blockb] &= !(u64::MAX >> (64 - bitb));
850850
}
851851
// Fill in all the other blocks (much faster than one bit at a time).
852852
for block in (blocka + 1)..blockb {

src/librustc/mir/interpret/pointer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ pub trait PointerArithmetic: layout::HasDataLayout {
7878
fn overflowing_signed_offset(&self, val: u64, i: i128) -> (u64, bool) {
7979
// FIXME: is it possible to over/underflow here?
8080
if i < 0 {
81-
// Trickery to ensure that `i64::min_value()` works fine: compute `n = -i`.
81+
// Trickery to ensure that `i64::MIN` works fine: compute `n = -i`.
8282
// This formula only works for true negative values; it overflows for zero!
83-
let n = u64::max_value() - (i as u64) + 1;
83+
let n = u64::MAX - (i as u64) + 1;
8484
let res = val.overflowing_sub(n);
8585
self.truncate_to_ptr(res)
8686
} else {

src/librustc/mir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ impl<'tcx> TerminatorKind<'tcx> {
11981198
t: BasicBlock,
11991199
f: BasicBlock,
12001200
) -> TerminatorKind<'tcx> {
1201-
static BOOL_SWITCH_FALSE: &'static [u128] = &[0];
1201+
static BOOL_SWITCH_FALSE: &[u128] = &[0];
12021202
TerminatorKind::SwitchInt {
12031203
discr: cond,
12041204
switch_ty: tcx.types.bool,

src/librustc/traits/structural_impls.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,9 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> {
415415
super::ReferenceOutlivesReferent(ty) => {
416416
tcx.lift(&ty).map(super::ReferenceOutlivesReferent)
417417
}
418-
super::ObjectTypeBound(ty, r) => tcx
419-
.lift(&ty)
420-
.and_then(|ty| tcx.lift(&r).and_then(|r| Some(super::ObjectTypeBound(ty, r)))),
418+
super::ObjectTypeBound(ty, r) => {
419+
tcx.lift(&ty).and_then(|ty| tcx.lift(&r).map(|r| super::ObjectTypeBound(ty, r)))
420+
}
421421
super::ObjectCastObligation(ty) => tcx.lift(&ty).map(super::ObjectCastObligation),
422422
super::Coercion { source, target } => {
423423
Some(super::Coercion { source: tcx.lift(&source)?, target: tcx.lift(&target)? })

src/librustc/ty/layout.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use rustc_span::DUMMY_SP;
77

88
use std::cmp;
99
use std::fmt;
10-
use std::i128;
1110
use std::iter;
1211
use std::mem;
1312
use std::ops::Bound;
@@ -1001,7 +1000,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
10011000
}
10021001
}
10031002

1004-
let (mut min, mut max) = (i128::max_value(), i128::min_value());
1003+
let (mut min, mut max) = (i128::MAX, i128::MIN);
10051004
let discr_type = def.repr.discr_type();
10061005
let bits = Integer::from_attr(self, discr_type).size().bits();
10071006
for (i, discr) in def.discriminants(tcx) {
@@ -1021,7 +1020,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
10211020
}
10221021
}
10231022
// We might have no inhabited variants, so pretend there's at least one.
1024-
if (min, max) == (i128::max_value(), i128::min_value()) {
1023+
if (min, max) == (i128::MAX, i128::MIN) {
10251024
min = 0;
10261025
max = 0;
10271026
}

src/librustc/ty/print/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ pub trait PrettyPrinter<'tcx>:
920920
}
921921
(ConstValue::Scalar(Scalar::Raw { data, .. }), ty::Uint(ui)) => {
922922
let bit_size = Integer::from_attr(&self.tcx(), UnsignedInt(*ui)).size();
923-
let max = truncate(u128::max_value(), bit_size);
923+
let max = truncate(u128::MAX, bit_size);
924924

925925
let ui_str = ui.name_str();
926926
if data == max {

src/librustc/ty/query/on_disk_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct AbsoluteBytePos(u32);
9292

9393
impl AbsoluteBytePos {
9494
fn new(pos: usize) -> AbsoluteBytePos {
95-
debug_assert!(pos <= ::std::u32::MAX as usize);
95+
debug_assert!(pos <= u32::MAX as usize);
9696
AbsoluteBytePos(pos as u32)
9797
}
9898

0 commit comments

Comments
 (0)