mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Rollup merge of #154879 - Zalathar:pattern-ty, r=Nadrieril
Don't store `pattern_ty` in `TestableCase` This field's only remaining use was in an assertion, but we can perform the same assertion earlier when constructing `TestableCase::Range`. --- For background, the `pattern_ty` field was introduced in https://github.com/rust-lang/rust/pull/136435 to replace a reference to the full THIR pattern node. Since then, most uses of `pattern_ty` were removed by https://github.com/rust-lang/rust/pull/150238.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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<Self>,
|
||||
|
||||
/// 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,
|
||||
}
|
||||
|
||||
|
||||
@@ -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 },
|
||||
|
||||
|
||||
Reference in New Issue
Block a user