File tree Expand file tree Collapse file tree 3 files changed +5
-11
lines changed Expand file tree Collapse file tree 3 files changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -1413,16 +1413,10 @@ impl ExprCollector<'_> {
14131413 ast:: Pat :: LiteralPat ( it)  => { 
14141414 Some ( Box :: new ( LiteralOrConst :: Literal ( pat_literal_to_hir ( it) ?. 0 ) ) ) 
14151415 } 
1416-  ast:: Pat :: IdentPat ( p)  => { 
1417-  let  name =
1418-  p. name ( ) . map ( |nr| nr. as_name ( ) ) . unwrap_or_else ( Name :: missing) ; 
1419-  Some ( Box :: new ( LiteralOrConst :: Const ( name. into ( ) ) ) ) 
1416+  pat @ ( ast:: Pat :: IdentPat ( _)  | ast:: Pat :: PathPat ( _) )  => { 
1417+  let  subpat = self . collect_pat ( pat. clone ( ) ,  binding_list) ; 
1418+  Some ( Box :: new ( LiteralOrConst :: Const ( subpat) ) ) 
14201419 } 
1421-  ast:: Pat :: PathPat ( p)  => p
1422-  . path ( ) 
1423-  . and_then ( |path| self . expander . parse_path ( self . db ,  path) ) 
1424-  . map ( LiteralOrConst :: Const ) 
1425-  . map ( Box :: new) , 
14261420 _ => None , 
14271421 } ) 
14281422 } ; 
Original file line number Diff line number Diff line change @@ -635,7 +635,7 @@ impl Printer<'_> {
635635 fn  print_literal_or_const ( & mut  self ,  literal_or_const :  & LiteralOrConst )  { 
636636 match  literal_or_const { 
637637 LiteralOrConst :: Literal ( l)  => self . print_literal ( l) , 
638-  LiteralOrConst :: Const ( c)  => self . print_path ( c) , 
638+  LiteralOrConst :: Const ( c)  => self . print_pat ( * c) , 
639639 } 
640640 } 
641641
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ pub enum Literal {
101101/// Used in range patterns. 
102102pub  enum  LiteralOrConst  { 
103103 Literal ( Literal ) , 
104-  Const ( Path ) , 
104+  Const ( PatId ) , 
105105} 
106106
107107impl  Literal  { 
                         You can’t perform that action at this time. 
           
                  
0 commit comments