@@ -16,9 +16,8 @@ use rustc_middle::thir::PatKind;
1616use  rustc_middle:: ty:: { self ,  Ty ,  TyCtxt } ; 
1717use  rustc_session:: lint:: builtin:: BINDINGS_WITH_VARIANT_NAME ; 
1818use  rustc_session:: lint:: builtin:: { IRREFUTABLE_LET_PATTERNS ,  UNREACHABLE_PATTERNS } ; 
19- use  rustc_session:: parse:: feature_err; 
2019use  rustc_session:: Session ; 
21- use  rustc_span:: { sym ,   Span } ; 
20+ use  rustc_span:: Span ; 
2221use  std:: slice; 
2322
2423crate  fn  check_match ( tcx :  TyCtxt < ' _ > ,  def_id :  DefId )  { 
@@ -115,9 +114,6 @@ impl PatCtxt<'_, '_> {
115114impl < ' tcx >  MatchVisitor < ' _ ,  ' tcx >  { 
116115    fn  check_patterns ( & mut  self ,  pat :  & Pat < ' _ > )  { 
117116        pat. walk_always ( |pat| check_borrow_conflicts_in_at_patterns ( self ,  pat) ) ; 
118-         if  !self . tcx . features ( ) . bindings_after_at  { 
119-             check_legality_of_bindings_in_at_patterns ( self ,  pat) ; 
120-         } 
121117        check_for_bindings_named_same_as_variants ( self ,  pat) ; 
122118    } 
123119
@@ -732,46 +728,3 @@ fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_>, pat: &Pat<'_
732728        err. emit ( ) ; 
733729    } 
734730} 
735- 
736- /// Forbids bindings in `@` patterns. This used to be is necessary for memory safety, 
737- /// because of the way rvalues were handled in the borrow check. (See issue #14587.) 
738- fn  check_legality_of_bindings_in_at_patterns ( cx :  & MatchVisitor < ' _ ,  ' _ > ,  pat :  & Pat < ' _ > )  { 
739-     AtBindingPatternVisitor  {  cx,  bindings_allowed :  true  } . visit_pat ( pat) ; 
740- 
741-     struct  AtBindingPatternVisitor < ' a ,  ' b ,  ' tcx >  { 
742-         cx :  & ' a  MatchVisitor < ' b ,  ' tcx > , 
743-         bindings_allowed :  bool , 
744-     } 
745- 
746-     impl < ' v >  Visitor < ' v >  for  AtBindingPatternVisitor < ' _ ,  ' _ ,  ' _ >  { 
747-         type  Map  = intravisit:: ErasedMap < ' v > ; 
748- 
749-         fn  nested_visit_map ( & mut  self )  -> NestedVisitorMap < Self :: Map >  { 
750-             NestedVisitorMap :: None 
751-         } 
752- 
753-         fn  visit_pat ( & mut  self ,  pat :  & Pat < ' _ > )  { 
754-             match  pat. kind  { 
755-                 hir:: PatKind :: Binding ( ..,  ref  subpat)  => { 
756-                     if  !self . bindings_allowed  { 
757-                         feature_err ( 
758-                             & self . cx . tcx . sess . parse_sess , 
759-                             sym:: bindings_after_at, 
760-                             pat. span , 
761-                             "pattern bindings after an `@` are unstable" , 
762-                         ) 
763-                         . emit ( ) ; 
764-                     } 
765- 
766-                     if  subpat. is_some ( )  { 
767-                         let  bindings_were_allowed = self . bindings_allowed ; 
768-                         self . bindings_allowed  = false ; 
769-                         intravisit:: walk_pat ( self ,  pat) ; 
770-                         self . bindings_allowed  = bindings_were_allowed; 
771-                     } 
772-                 } 
773-                 _ => intravisit:: walk_pat ( self ,  pat) , 
774-             } 
775-         } 
776-     } 
777- } 
0 commit comments