@@ -4,7 +4,6 @@ use super::_match::WitnessPreference::*;
44
55use super :: { PatCtxt , PatternError , PatKind } ;
66
7- use rustc:: middle:: borrowck:: SignalledError ;
87use rustc:: session:: Session ;
98use rustc:: ty:: { self , Ty , TyCtxt } ;
109use rustc:: ty:: subst:: { InternalSubsts , SubstsRef } ;
@@ -21,22 +20,19 @@ use std::slice;
2120
2221use syntax_pos:: { Span , DUMMY_SP , MultiSpan } ;
2322
24- crate fn check_match ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> SignalledError {
25- let body_id = if let Some ( id) = tcx. hir ( ) . as_local_hir_id ( def_id) {
26- tcx. hir ( ) . body_owned_by ( id)
27- } else {
28- return SignalledError :: NoErrorsSeen ;
23+ crate fn check_match ( tcx : TyCtxt < ' _ > , def_id : DefId ) {
24+ let body_id = match tcx. hir ( ) . as_local_hir_id ( def_id) {
25+ None => return ,
26+ Some ( id) => tcx. hir ( ) . body_owned_by ( id) ,
2927 } ;
3028
3129 let mut visitor = MatchVisitor {
3230 tcx,
3331 tables : tcx. body_tables ( body_id) ,
3432 param_env : tcx. param_env ( def_id) ,
3533 identity_substs : InternalSubsts :: identity_for_item ( tcx, def_id) ,
36- signalled_error : SignalledError :: NoErrorsSeen ,
3734 } ;
3835 visitor. visit_body ( tcx. hir ( ) . body ( body_id) ) ;
39- visitor. signalled_error
4036}
4137
4238fn create_e0004 ( sess : & Session , sp : Span , error_message : String ) -> DiagnosticBuilder < ' _ > {
@@ -48,7 +44,6 @@ struct MatchVisitor<'a, 'tcx> {
4844 tables : & ' a ty:: TypeckTables < ' tcx > ,
4945 param_env : ty:: ParamEnv < ' tcx > ,
5046 identity_substs : SubstsRef < ' tcx > ,
51- signalled_error : SignalledError ,
5247}
5348
5449impl < ' tcx > Visitor < ' tcx > for MatchVisitor < ' _ , ' tcx > {
@@ -136,13 +131,7 @@ impl<'tcx> MatchVisitor<'_, 'tcx> {
136131 // First, check legality of move bindings.
137132 self . check_patterns ( arm. guard . is_some ( ) , & arm. pat ) ;
138133
139- // Second, if there is a guard on each arm, make sure it isn't
140- // assigning or borrowing anything mutably.
141- if arm. guard . is_some ( ) {
142- self . signalled_error = SignalledError :: SawSomeError ;
143- }
144-
145- // Third, perform some lints.
134+ // Second, perform some lints.
146135 check_for_bindings_named_same_as_variants ( self , & arm. pat ) ;
147136 }
148137
0 commit comments