Remove PatKind::Range

This commit is contained in:
Zalathar 2024-08-03 20:59:02 +10:00
parent 9952e4d4c8
commit 2b6f4386eb
2 changed files with 1 additions and 5 deletions

View File

@ -807,7 +807,7 @@ fn hoist_pat_range(&self, range: &IntRange, ty: RevealedTy<'tcx>) -> print::Pat<
range.hi range.hi
}; };
let hi = cx.hoist_pat_range_bdy(hi, ty); let hi = cx.hoist_pat_range_bdy(hi, ty);
PatKind::Range(Box::new(PatRange { lo, hi, end, ty: ty.inner() })) PatKind::Print(PatRange { lo, hi, end, ty: ty.inner() }.to_string())
}; };
Pat { ty: ty.inner(), kind } Pat { ty: ty.inner(), kind }

View File

@ -12,7 +12,6 @@
use std::fmt; use std::fmt;
use rustc_middle::bug; use rustc_middle::bug;
use rustc_middle::thir::PatRange;
use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt}; use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt};
use rustc_span::sym; use rustc_span::sym;
use rustc_target::abi::{FieldIdx, VariantIdx}; use rustc_target::abi::{FieldIdx, VariantIdx};
@ -33,8 +32,6 @@ pub(crate) struct Pat<'tcx> {
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub(crate) enum PatKind<'tcx> { pub(crate) enum PatKind<'tcx> {
Range(Box<PatRange<'tcx>>),
Slice { Slice {
prefix: Box<[Box<Pat<'tcx>>]>, prefix: Box<[Box<Pat<'tcx>>]>,
/// True if this slice-like pattern should include a `..` between the /// True if this slice-like pattern should include a `..` between the
@ -52,7 +49,6 @@ impl<'tcx> fmt::Display for Pat<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.kind { match self.kind {
PatKind::Never => write!(f, "!"), PatKind::Never => write!(f, "!"),
PatKind::Range(ref range) => write!(f, "{range}"),
PatKind::Slice { ref prefix, has_dot_dot, ref suffix } => { PatKind::Slice { ref prefix, has_dot_dot, ref suffix } => {
write_slice_like(f, prefix, has_dot_dot, suffix) write_slice_like(f, prefix, has_dot_dot, suffix)
} }