File tree 2 files changed +11
-15
lines changed
librustc_mir/hair/pattern
2 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -1291,17 +1291,6 @@ pub struct Arm {
1291
1291
pub body : P < Expr > ,
1292
1292
}
1293
1293
1294
- impl Arm {
1295
- // HACK(or_patterns; Centril | dlrobertson): Remove this and
1296
- // correctly handle each case in which this method is used.
1297
- pub fn top_pats_hack ( & self ) -> & [ P < Pat > ] {
1298
- match & self . pat . kind {
1299
- PatKind :: Or ( pats) => pats,
1300
- _ => std:: slice:: from_ref ( & self . pat ) ,
1301
- }
1302
- }
1303
- }
1304
-
1305
1294
#[ derive( RustcEncodable , RustcDecodable , Debug , HashStable ) ]
1306
1295
pub enum Guard {
1307
1296
If ( P < Expr > ) ,
Original file line number Diff line number Diff line change @@ -140,10 +140,17 @@ impl<'tcx> MatchVisitor<'_, 'tcx> {
140
140
let mut have_errors = false ;
141
141
142
142
let inlined_arms : Vec < ( Vec < _ > , _ ) > = arms. iter ( ) . map ( |arm| (
143
- arm. top_pats_hack ( ) . iter ( ) . map ( |pat| {
144
- let mut patcx = PatCtxt :: new ( self . tcx ,
145
- self . param_env . and ( self . identity_substs ) ,
146
- self . tables ) ;
143
+ // HACK(or_patterns; Centril | dlrobertson): Remove this and
144
+ // correctly handle exhaustiveness checking for nested or-patterns.
145
+ match & arm. pat . kind {
146
+ hir:: PatKind :: Or ( pats) => pats,
147
+ _ => std:: slice:: from_ref ( & arm. pat ) ,
148
+ } . iter ( ) . map ( |pat| {
149
+ let mut patcx = PatCtxt :: new (
150
+ self . tcx ,
151
+ self . param_env . and ( self . identity_substs ) ,
152
+ self . tables
153
+ ) ;
147
154
patcx. include_lint_checks ( ) ;
148
155
let pattern = expand_pattern ( cx, patcx. lower_pattern ( & pat) ) ;
149
156
if !patcx. errors . is_empty ( ) {
You can’t perform that action at this time.
0 commit comments