@@ -4,7 +4,6 @@ use super::_match::WitnessPreference::*;
4
4
5
5
use super :: { PatCtxt , PatternError , PatKind } ;
6
6
7
- use rustc:: middle:: borrowck:: SignalledError ;
8
7
use rustc:: session:: Session ;
9
8
use rustc:: ty:: { self , Ty , TyCtxt } ;
10
9
use rustc:: ty:: subst:: { InternalSubsts , SubstsRef } ;
@@ -21,22 +20,19 @@ use std::slice;
21
20
22
21
use syntax_pos:: { Span , DUMMY_SP , MultiSpan } ;
23
22
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) ,
29
27
} ;
30
28
31
29
let mut visitor = MatchVisitor {
32
30
tcx,
33
31
tables : tcx. body_tables ( body_id) ,
34
32
param_env : tcx. param_env ( def_id) ,
35
33
identity_substs : InternalSubsts :: identity_for_item ( tcx, def_id) ,
36
- signalled_error : SignalledError :: NoErrorsSeen ,
37
34
} ;
38
35
visitor. visit_body ( tcx. hir ( ) . body ( body_id) ) ;
39
- visitor. signalled_error
40
36
}
41
37
42
38
fn create_e0004 ( sess : & Session , sp : Span , error_message : String ) -> DiagnosticBuilder < ' _ > {
@@ -48,7 +44,6 @@ struct MatchVisitor<'a, 'tcx> {
48
44
tables : & ' a ty:: TypeckTables < ' tcx > ,
49
45
param_env : ty:: ParamEnv < ' tcx > ,
50
46
identity_substs : SubstsRef < ' tcx > ,
51
- signalled_error : SignalledError ,
52
47
}
53
48
54
49
impl < ' tcx > Visitor < ' tcx > for MatchVisitor < ' _ , ' tcx > {
@@ -136,13 +131,7 @@ impl<'tcx> MatchVisitor<'_, 'tcx> {
136
131
// First, check legality of move bindings.
137
132
self . check_patterns ( arm. guard . is_some ( ) , & arm. pat ) ;
138
133
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.
146
135
check_for_bindings_named_same_as_variants ( self , & arm. pat ) ;
147
136
}
148
137
0 commit comments