@@ -18,8 +18,8 @@ use rustc_middle::ty::{
18
18
self , GenericArgs , GenericArgsRef , GenericParamDefKind , Ty , TypeVisitableExt ,
19
19
} ;
20
20
use rustc_middle:: { bug, span_bug} ;
21
- use rustc_span:: Span ;
22
21
use rustc_span:: symbol:: Ident ;
22
+ use rustc_span:: { ErrorGuaranteed , Span } ;
23
23
use rustc_trait_selection:: traits:: query:: evaluate_obligation:: InferCtxtExt ;
24
24
use rustc_trait_selection:: traits:: { self , NormalizeExt } ;
25
25
use tracing:: { debug, instrument} ;
@@ -66,6 +66,9 @@ pub(crate) enum MethodError<'tcx> {
66
66
67
67
// Found a match, but the return type is wrong
68
68
BadReturnType ,
69
+
70
+ // Error has already been emitted, no need to emit another one.
71
+ ErrorReported ( ErrorGuaranteed ) ,
69
72
}
70
73
71
74
// Contains a list of static methods that may apply, a list of unsatisfied trait predicates which
@@ -120,6 +123,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
120
123
Err ( PrivateMatch ( ..) ) => false ,
121
124
Err ( IllegalSizedBound { .. } ) => true ,
122
125
Err ( BadReturnType ) => false ,
126
+ Err ( ErrorReported ( _) ) => false ,
123
127
}
124
128
}
125
129
0 commit comments