File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -1259,21 +1259,32 @@ pub struct Local {
1259
1259
}
1260
1260
1261
1261
/// Represents a single arm of a `match` expression, e.g.
1262
- /// `<pats > (if <guard>) => <body>`.
1262
+ /// `<pat > (if <guard>) => <body>`.
1263
1263
#[ derive( RustcEncodable , RustcDecodable , Debug , HashStable ) ]
1264
1264
pub struct Arm {
1265
1265
#[ stable_hasher( ignore) ]
1266
1266
pub hir_id : HirId ,
1267
1267
pub span : Span ,
1268
1268
pub attrs : HirVec < Attribute > ,
1269
- /// Multiple patterns can be combined with `|`
1270
- pub pats : HirVec < P < Pat > > ,
1269
+ /// If this pattern and the optional guard matches, then `body` is evaluated.
1270
+ pub pat : P < Pat > ,
1271
1271
/// Optional guard clause.
1272
1272
pub guard : Option < Guard > ,
1273
1273
/// The expression the arm evaluates to if this arm matches.
1274
1274
pub body : P < Expr > ,
1275
1275
}
1276
1276
1277
+ impl Arm {
1278
+ // HACK(or_patterns; Centril | dlrobertson): Remove this and
1279
+ // correctly handle each case in which this method is used.
1280
+ pub fn top_pats_hack ( & self ) -> & [ P < Pat > ] {
1281
+ match & self . pat . node {
1282
+ PatKind :: Or ( pats) => pats,
1283
+ _ => std:: slice:: from_ref ( & self . pat ) ,
1284
+ }
1285
+ }
1286
+ }
1287
+
1277
1288
#[ derive( RustcEncodable , RustcDecodable , Debug , HashStable ) ]
1278
1289
pub enum Guard {
1279
1290
If ( P < Expr > ) ,
You can’t perform that action at this time.
0 commit comments