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 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
range.hi
};
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 }

View File

@ -12,7 +12,6 @@
use std::fmt;
use rustc_middle::bug;
use rustc_middle::thir::PatRange;
use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt};
use rustc_span::sym;
use rustc_target::abi::{FieldIdx, VariantIdx};
@ -33,8 +32,6 @@ pub(crate) struct Pat<'tcx> {
#[derive(Clone, Debug)]
pub(crate) enum PatKind<'tcx> {
Range(Box<PatRange<'tcx>>),
Slice {
prefix: Box<[Box<Pat<'tcx>>]>,
/// 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 {
match self.kind {
PatKind::Never => write!(f, "!"),
PatKind::Range(ref range) => write!(f, "{range}"),
PatKind::Slice { ref prefix, has_dot_dot, ref suffix } => {
write_slice_like(f, prefix, has_dot_dot, suffix)
}