diff --git a/compiler/rustc_mir_build/src/builder/matches/match_pair.rs b/compiler/rustc_mir_build/src/builder/matches/match_pair.rs index cbe31fd7d132..bd18a215aea7 100644 --- a/compiler/rustc_mir_build/src/builder/matches/match_pair.rs +++ b/compiler/rustc_mir_build/src/builder/matches/match_pair.rs @@ -152,6 +152,7 @@ pub(super) fn for_pattern( } PatKind::Range(ref range) => { + assert_eq!(pattern.ty, range.ty); if range.is_full_range(cx.tcx) == Some(true) { None } else { @@ -380,7 +381,6 @@ pub(super) fn for_pattern( place, testable_case, subpairs, - pattern_ty: pattern.ty, pattern_span: pattern.span, }) } else { diff --git a/compiler/rustc_mir_build/src/builder/matches/mod.rs b/compiler/rustc_mir_build/src/builder/matches/mod.rs index d4f5fe84e0ff..5604e86e0672 100644 --- a/compiler/rustc_mir_build/src/builder/matches/mod.rs +++ b/compiler/rustc_mir_build/src/builder/matches/mod.rs @@ -1277,7 +1277,7 @@ enum PatConstKind { /// tested, and a test to perform on that place. /// /// Each node also has a list of subpairs (possibly empty) that must also match, -/// and a reference to the THIR pattern it represents. +/// and some additional information from the THIR pattern it represents. #[derive(Debug, Clone)] pub(crate) struct MatchPairTree<'tcx> { /// This place... @@ -1301,9 +1301,7 @@ pub(crate) struct MatchPairTree<'tcx> { /// that tests its field for the value `3`. subpairs: Vec, - /// Type field of the pattern this node was created from. - pattern_ty: Ty<'tcx>, - /// Span field of the pattern this node was created from. + /// Span field of the THIR pattern this node was created from. pattern_span: Span, } diff --git a/compiler/rustc_mir_build/src/builder/matches/test.rs b/compiler/rustc_mir_build/src/builder/matches/test.rs index d8911870d3ad..9b7b6f574fe3 100644 --- a/compiler/rustc_mir_build/src/builder/matches/test.rs +++ b/compiler/rustc_mir_build/src/builder/matches/test.rs @@ -44,10 +44,7 @@ pub(super) fn pick_test_for_match_pair( TestKind::ScalarEq { value } } - TestableCase::Range(ref range) => { - assert_eq!(range.ty, match_pair.pattern_ty); - TestKind::Range(Arc::clone(range)) - } + TestableCase::Range(ref range) => TestKind::Range(Arc::clone(range)), TestableCase::Slice { len, op } => TestKind::SliceLen { len, op },