Skip to content

Commit 0777344

Browse files
committed
Also remove pat_ty from TestKind::ScalarEq
1 parent aaade73 commit 0777344

2 files changed

Lines changed: 5 additions & 13 deletions

File tree

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,11 +1345,7 @@ enum TestKind<'tcx> {
13451345
},
13461346

13471347
/// Tests the place against a constant using scalar equality.
1348-
ScalarEq {
1349-
value: ty::Value<'tcx>,
1350-
/// Type of the corresponding pattern node.
1351-
pat_ty: Ty<'tcx>,
1352-
},
1348+
ScalarEq { value: ty::Value<'tcx> },
13531349

13541350
/// Test whether the value falls within an inclusive or exclusive range.
13551351
Range(Arc<PatRange<'tcx>>),

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
4242
TestKind::StringEq { value }
4343
}
4444
TestableCase::Constant { value, kind: PatConstKind::Float | PatConstKind::Other } => {
45-
TestKind::ScalarEq { value, pat_ty: match_pair.pattern_ty }
45+
TestKind::ScalarEq { value }
4646
}
4747

4848
TestableCase::Range(ref range) => {
@@ -182,7 +182,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
182182
);
183183
}
184184

185-
TestKind::ScalarEq { value, pat_ty } => {
185+
TestKind::ScalarEq { value } => {
186186
let tcx = self.tcx;
187187
let success_block = target_block(TestBranch::Success);
188188
let fail_block = target_block(TestBranch::Failure);
@@ -191,12 +191,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
191191
let mut expected_value_operand =
192192
self.literal_operand(test.span, Const::from_ty_value(tcx, value));
193193

194-
let mut actual_value_ty = pat_ty;
195194
let mut actual_value_place = place;
196195

197-
match pat_ty.kind() {
196+
match value.ty.kind() {
198197
&ty::Pat(base, _) => {
199-
assert_eq!(pat_ty, value.ty);
200198
assert!(base.is_trivially_pure_clone_copy());
201199

202200
let transmuted_place = self.temp(base, test.span);
@@ -220,15 +218,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
220218
);
221219

222220
actual_value_place = transmuted_place;
223-
actual_value_ty = base;
224221
expected_value_operand = Operand::Copy(transmuted_expect);
225222
expected_value_ty = base;
226223
}
227224
_ => {}
228225
}
229226

230-
assert_eq!(expected_value_ty, actual_value_ty);
231-
assert!(actual_value_ty.is_scalar());
227+
assert!(expected_value_ty.is_scalar());
232228

233229
self.compare(
234230
block,

0 commit comments

Comments
 (0)