Skip to content

Commit eacd56a

Browse files
RalfJungBoxyUwU
andcommitted
Apply suggestions from code review
Co-authored-by: Boxy <[email protected]>
1 parent cbb5fc1 commit eacd56a

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

compiler/rustc_middle/src/thir.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ impl<'tcx> PatRangeBoundary<'tcx> {
10321032
Self::NegInfinity | Self::PosInfinity => None,
10331033
}
10341034
}
1035-
pub fn eval_bits(self, ty: Ty<'tcx>, tcx: TyCtxt<'tcx>) -> u128 {
1035+
pub fn to_bits(self, ty: Ty<'tcx>, tcx: TyCtxt<'tcx>) -> u128 {
10361036
match self {
10371037
Self::Finite(value) => value.try_to_scalar_int().unwrap().to_bits_unchecked(),
10381038
Self::NegInfinity => {
@@ -1075,8 +1075,8 @@ impl<'tcx> PatRangeBoundary<'tcx> {
10751075
_ => {}
10761076
}
10771077

1078-
let a = self.eval_bits(ty, tcx);
1079-
let b = other.eval_bits(ty, tcx);
1078+
let a = self.to_bits(ty, tcx);
1079+
let b = other.to_bits(ty, tcx);
10801080

10811081
match ty.kind() {
10821082
ty::Float(ty::FloatTy::F16) => {

compiler/rustc_middle/src/ty/consts/valtree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pub type ConstToValTreeResult<'tcx> = Result<Result<ValTree<'tcx>, Ty<'tcx>>, Er
135135
/// A type-level constant value.
136136
///
137137
/// Represents a typed, fully evaluated constant.
138-
/// Note that this is used by pattern elaboration to represent values which cannot occur in types,
138+
/// Note that this is also used by pattern elaboration to represent values which cannot occur in types,
139139
/// such as raw pointers and floats.
140140
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
141141
#[derive(HashStable, TyEncodable, TyDecodable, TypeFoldable, TypeVisitable, Lift)]

compiler/rustc_mir_build/src/builder/matches/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,12 +1331,12 @@ enum TestKind<'tcx> {
13311331
If,
13321332

13331333
/// Test for equality with value, possibly after an unsizing coercion to
1334-
/// `ty`,
1334+
/// `cast_ty`,
13351335
Eq {
13361336
value: ty::Value<'tcx>,
13371337
// Integer types are handled by `SwitchInt`, and constants with ADT
13381338
// types and `&[T]` types are converted back into patterns, so this can
1339-
// only be `&str` or `f*`.
1339+
// only be `&str` or floats.
13401340
cast_ty: Ty<'tcx>,
13411341
},
13421342

compiler/rustc_mir_build/src/builder/matches/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
695695
}
696696
}
697697

698-
(TestKind::Eq { value: test_val, .. }, TestCase::Constant { value: case_val, .. }) => {
698+
(TestKind::Eq { value: test_val, .. }, TestCase::Constant { value: case_val }) => {
699699
if test_val == case_val {
700700
fully_matched = true;
701701
Some(TestBranch::Success)

0 commit comments

Comments
 (0)