Skip to content

Commit 3468b8d

Browse files
committed
Remove PatWildMulti
1 parent cc8d398 commit 3468b8d

File tree

29 files changed

+47
-89
lines changed

29 files changed

+47
-89
lines changed

src/librustc/middle/cfg/construct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
104104
hir::PatQPath(..) |
105105
hir::PatLit(..) |
106106
hir::PatRange(..) |
107-
hir::PatWild(_) => {
107+
hir::PatWild => {
108108
self.add_ast_node(pat.id, &[pred])
109109
}
110110

src/librustc/middle/check_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
176176
if mode == Mode::ConstFn {
177177
for arg in &fd.inputs {
178178
match arg.pat.node {
179-
hir::PatWild(_) => {}
179+
hir::PatWild => {}
180180
hir::PatIdent(hir::BindByValue(hir::MutImmutable), _, None) => {}
181181
_ => {
182182
span_err!(self.tcx.sess, arg.pat.span, E0022,

src/librustc/middle/check_match.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use util::nodemap::FnvHashMap;
4747

4848
pub const DUMMY_WILD_PAT: &'static Pat = &Pat {
4949
id: DUMMY_NODE_ID,
50-
node: hir::PatWild(hir::PatWildSingle),
50+
node: hir::PatWild,
5151
span: DUMMY_SP
5252
};
5353

@@ -521,7 +521,7 @@ fn construct_witness<'a,'tcx>(cx: &MatchCheckCtxt<'a,'tcx>, ctor: &Constructor,
521521
if let VariantKind::Struct = v.kind() {
522522
let field_pats: Vec<_> = v.fields.iter()
523523
.zip(pats)
524-
.filter(|&(_, ref pat)| pat.node != hir::PatWild(hir::PatWildSingle))
524+
.filter(|&(_, ref pat)| pat.node != hir::PatWild)
525525
.map(|(field, pat)| Spanned {
526526
span: DUMMY_SP,
527527
node: hir::FieldPat {
@@ -553,7 +553,7 @@ fn construct_witness<'a,'tcx>(cx: &MatchCheckCtxt<'a,'tcx>, ctor: &Constructor,
553553
},
554554
_ => unreachable!()
555555
},
556-
ty::TyStr => hir::PatWild(hir::PatWildSingle),
556+
ty::TyStr => hir::PatWild,
557557

558558
_ => {
559559
assert_eq!(pats_len, 1);
@@ -570,7 +570,7 @@ fn construct_witness<'a,'tcx>(cx: &MatchCheckCtxt<'a,'tcx>, ctor: &Constructor,
570570
_ => {
571571
match *ctor {
572572
ConstantValue(ref v) => hir::PatLit(const_val_to_expr(v)),
573-
_ => hir::PatWild(hir::PatWildSingle),
573+
_ => hir::PatWild,
574574
}
575575
}
576576
};
@@ -799,7 +799,7 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
799799
},
800800
hir::PatBox(_) | hir::PatTup(_) | hir::PatRegion(..) =>
801801
vec!(Single),
802-
hir::PatWild(_) =>
802+
hir::PatWild =>
803803
vec!(),
804804
}
805805
}
@@ -862,7 +862,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
862862
id: pat_id, ref node, span: pat_span
863863
} = raw_pat(r[col]);
864864
let head: Option<Vec<&Pat>> = match *node {
865-
hir::PatWild(_) =>
865+
hir::PatWild =>
866866
Some(vec![DUMMY_WILD_PAT; arity]),
867867

868868
hir::PatIdent(_, _, _) => {

src/librustc/middle/dead.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
142142
_ => self.tcx.sess.span_bug(lhs.span, "non-ADT in struct pattern")
143143
};
144144
for pat in pats {
145-
if let hir::PatWild(hir::PatWildSingle) = pat.node.pat.node {
145+
if let hir::PatWild = pat.node.pat.node {
146146
continue;
147147
}
148148
self.insert_def_id(variant.field_named(pat.node.name).did);

src/librustc/middle/expr_use_visitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
11411141
// will visit the substructure recursively.
11421142
}
11431143

1144-
hir::PatWild(_) | hir::PatTup(..) | hir::PatBox(..) |
1144+
hir::PatWild | hir::PatTup(..) | hir::PatBox(..) |
11451145
hir::PatRegion(..) | hir::PatLit(..) | hir::PatRange(..) |
11461146
hir::PatVec(..) => {
11471147
// Similarly, each of these cases does not

src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
12111211
};
12121212

12131213
match pat.node {
1214-
hir::PatWild(_) => {
1214+
hir::PatWild => {
12151215
// _
12161216
}
12171217

src/librustc/middle/pat_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub fn pat_is_binding(dm: &DefMap, pat: &hir::Pat) -> bool {
101101
pub fn pat_is_binding_or_wild(dm: &DefMap, pat: &hir::Pat) -> bool {
102102
match pat.node {
103103
hir::PatIdent(..) => pat_is_binding(dm, pat),
104-
hir::PatWild(_) => true,
104+
hir::PatWild => true,
105105
_ => false
106106
}
107107
}

src/librustc/middle/stability.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -543,11 +543,6 @@ pub fn check_pat(tcx: &ty::ctxt, pat: &hir::Pat,
543543
// Foo(a, b, c)
544544
hir::PatEnum(_, Some(ref pat_fields)) => {
545545
for (field, struct_field) in pat_fields.iter().zip(&v.fields) {
546-
// a .. pattern is fine, but anything positional is
547-
// not.
548-
if let hir::PatWild(hir::PatWildMulti) = field.node {
549-
continue
550-
}
551546
maybe_do_stability_check(tcx, struct_field.did, field.span, cb)
552547
}
553548
}

src/librustc_front/fold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ pub fn noop_fold_pat<T: Folder>(p: P<Pat>, folder: &mut T) -> P<Pat> {
10101010
Pat {
10111011
id: folder.new_id(id),
10121012
node: match node {
1013-
PatWild(k) => PatWild(k),
1013+
PatWild => PatWild,
10141014
PatIdent(binding_mode, pth1, sub) => {
10151015
PatIdent(binding_mode,
10161016
Spanned {

src/librustc_front/hir.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ pub use self::Item_::*;
2424
pub use self::Mutability::*;
2525
pub use self::Pat_::*;
2626
pub use self::PathListItem_::*;
27-
pub use self::PatWildKind::*;
2827
pub use self::PrimTy::*;
2928
pub use self::Stmt_::*;
3029
pub use self::StructFieldKind::*;
@@ -393,19 +392,10 @@ pub enum BindingMode {
393392
BindByValue(Mutability),
394393
}
395394

396-
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
397-
pub enum PatWildKind {
398-
/// Represents the wildcard pattern `_`
399-
PatWildSingle,
400-
401-
/// Represents the wildcard pattern `..`
402-
PatWildMulti,
403-
}
404-
405395
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
406396
pub enum Pat_ {
407-
/// Represents a wildcard pattern (either `_` or `..`)
408-
PatWild(PatWildKind),
397+
/// Represents a wildcard pattern (`_`)
398+
PatWild,
409399

410400
/// A PatIdent may either be a new bound variable,
411401
/// or a nullary enum (in which case the third field

0 commit comments

Comments
 (0)