Skip to content

Commit 2330afa

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

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
@@ -1034,7 +1034,7 @@ impl<'tcx> PatRangeBoundary<'tcx> {
10341034
Self::NegInfinity | Self::PosInfinity => None,
10351035
}
10361036
}
1037-
pub fn eval_bits(self, ty: Ty<'tcx>, tcx: TyCtxt<'tcx>) -> u128 {
1037+
pub fn to_bits(self, ty: Ty<'tcx>, tcx: TyCtxt<'tcx>) -> u128 {
10381038
match self {
10391039
Self::Finite(value) => value.try_to_scalar_int().unwrap().to_bits_unchecked(),
10401040
Self::NegInfinity => {
@@ -1077,8 +1077,8 @@ impl<'tcx> PatRangeBoundary<'tcx> {
10771077
_ => {}
10781078
}
10791079

1080-
let a = self.eval_bits(ty, tcx);
1081-
let b = other.eval_bits(ty, tcx);
1080+
let a = self.to_bits(ty, tcx);
1081+
let b = other.to_bits(ty, tcx);
10821082

10831083
match ty.kind() {
10841084
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
@@ -1316,12 +1316,12 @@ enum TestKind<'tcx> {
13161316
If,
13171317

13181318
/// Test for equality with value, possibly after an unsizing coercion to
1319-
/// `ty`,
1319+
/// `cast_ty`,
13201320
Eq {
13211321
value: ty::Value<'tcx>,
13221322
// Integer types are handled by `SwitchInt`, and constants with ADT
13231323
// types and `&[T]` types are converted back into patterns, so this can
1324-
// only be `&str` or `f*`.
1324+
// only be `&str` or floats.
13251325
cast_ty: Ty<'tcx>,
13261326
},
13271327

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)