Fold PatKind::NamedConstant into PatKind::Constant

This commit is contained in:
Esteban Küber
2024-11-06 21:10:31 +00:00
parent ff2f7a7a83
commit c25b44bee9
12 changed files with 21 additions and 33 deletions

View File

@@ -640,7 +640,6 @@ impl<'tcx> Pat<'tcx> {
| Range(..)
| Binding { subpattern: None, .. }
| Constant { .. }
| NamedConstant { .. }
| Error(_) => {}
AscribeUserType { subpattern, .. }
| Binding { subpattern: Some(subpattern), .. }
@@ -787,12 +786,8 @@ pub enum PatKind<'tcx> {
/// * `String`, if `string_deref_patterns` is enabled.
Constant {
value: mir::Const<'tcx>,
},
/// Same as `Constant`, but that came from a `const` that we can point at in diagnostics.
NamedConstant {
value: mir::Const<'tcx>,
span: Span,
/// The `const` item this constant came from, if any.
opt_def: Option<DefId>,
},
/// Inline constant found while lowering a pattern.

View File

@@ -246,7 +246,7 @@ pub fn walk_pat<'thir, 'tcx: 'thir, V: Visitor<'thir, 'tcx>>(
visitor.visit_pat(&subpattern.pattern);
}
}
Constant { value: _ } | NamedConstant { value: _, span: _ } => {}
Constant { value: _, opt_def: _ } => {}
InlineConstant { def: _, subpattern } => visitor.visit_pat(subpattern),
Range(_) => {}
Slice { prefix, slice, suffix } | Array { prefix, slice, suffix } => {