Skip to content

Commit 92eb159

Browse files
committed
Remove PatKind::Wild
1 parent f53eb27 commit 92eb159

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

compiler/rustc_pattern_analysis/src/rustc.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
780780
use MaybeInfiniteInt::*;
781781
let cx = self;
782782
let kind = if matches!((range.lo, range.hi), (NegInfinity, PosInfinity)) {
783-
PatKind::Wild
783+
PatKind::Print("_".to_string())
784784
} else if range.is_singleton() {
785785
let lo = cx.hoist_pat_range_bdy(range.lo, ty);
786786
let value = lo.as_finite().unwrap();
@@ -890,7 +890,9 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
890890
}
891891
&Str(value) => PatKind::Constant { value },
892892
Never if self.tcx.features().never_patterns => PatKind::Never,
893-
Never | Wildcard | NonExhaustive | Hidden | PrivateUninhabited => PatKind::Wild,
893+
Never | Wildcard | NonExhaustive | Hidden | PrivateUninhabited => {
894+
PatKind::Print("_".to_string())
895+
}
894896
Missing { .. } => bug!(
895897
"trying to convert a `Missing` constructor into a `Pat`; this is probably a bug,
896898
`Missing` should have been processed in `apply_constructors`"

compiler/rustc_pattern_analysis/src/rustc/print.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ pub(crate) struct Pat<'tcx> {
3232

3333
#[derive(Clone, Debug)]
3434
pub(crate) enum PatKind<'tcx> {
35-
Wild,
36-
3735
StructLike {
3836
enum_info: EnumInfo<'tcx>,
3937
subpatterns: Vec<FieldPat<'tcx>>,
@@ -69,7 +67,6 @@ pub(crate) enum PatKind<'tcx> {
6967
impl<'tcx> fmt::Display for Pat<'tcx> {
7068
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7169
match self.kind {
72-
PatKind::Wild => write!(f, "_"),
7370
PatKind::Never => write!(f, "!"),
7471
PatKind::Box { ref subpattern } => write!(f, "box {subpattern}"),
7572
PatKind::StructLike { ref enum_info, ref subpatterns } => {

0 commit comments

Comments
 (0)