File tree Expand file tree Collapse file tree 2 files changed +11
-15
lines changed
librustc_mir/hair/pattern Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -1291,17 +1291,6 @@ pub struct Arm {
12911291 pub body : P < Expr > ,
12921292}
12931293
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-
13051294#[ derive( RustcEncodable , RustcDecodable , Debug , HashStable ) ]
13061295pub enum Guard {
13071296 If ( P < Expr > ) ,
Original file line number Diff line number Diff line change @@ -140,10 +140,17 @@ impl<'tcx> MatchVisitor<'_, 'tcx> {
140140 let mut have_errors = false ;
141141
142142 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+ ) ;
147154 patcx. include_lint_checks ( ) ;
148155 let pattern = expand_pattern ( cx, patcx. lower_pattern ( & pat) ) ;
149156 if !patcx. errors . is_empty ( ) {
You can’t perform that action at this time.
0 commit comments