@@ -16,9 +16,8 @@ use rustc_middle::thir::PatKind;
16
16
use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
17
17
use rustc_session:: lint:: builtin:: BINDINGS_WITH_VARIANT_NAME ;
18
18
use rustc_session:: lint:: builtin:: { IRREFUTABLE_LET_PATTERNS , UNREACHABLE_PATTERNS } ;
19
- use rustc_session:: parse:: feature_err;
20
19
use rustc_session:: Session ;
21
- use rustc_span:: { sym , Span } ;
20
+ use rustc_span:: Span ;
22
21
use std:: slice;
23
22
24
23
crate fn check_match ( tcx : TyCtxt < ' _ > , def_id : DefId ) {
@@ -115,9 +114,6 @@ impl PatCtxt<'_, '_> {
115
114
impl < ' tcx > MatchVisitor < ' _ , ' tcx > {
116
115
fn check_patterns ( & mut self , pat : & Pat < ' _ > ) {
117
116
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
- }
121
117
check_for_bindings_named_same_as_variants ( self , pat) ;
122
118
}
123
119
@@ -732,46 +728,3 @@ fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_>, pat: &Pat<'_
732
728
err. emit ( ) ;
733
729
}
734
730
}
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