@@ -18,8 +18,8 @@ use rustc_middle::ty::{
1818 self , GenericArgs , GenericArgsRef , GenericParamDefKind , Ty , TypeVisitableExt ,
1919} ;
2020use rustc_middle:: { bug, span_bug} ;
21- use rustc_span:: Span ;
2221use rustc_span:: symbol:: Ident ;
22+ use rustc_span:: { ErrorGuaranteed , Span } ;
2323use rustc_trait_selection:: traits:: query:: evaluate_obligation:: InferCtxtExt ;
2424use rustc_trait_selection:: traits:: { self , NormalizeExt } ;
2525use tracing:: { debug, instrument} ;
@@ -66,6 +66,9 @@ pub(crate) enum MethodError<'tcx> {
6666
6767 // Found a match, but the return type is wrong
6868 BadReturnType ,
69+
70+ // Error has already been emitted, no need to emit another one.
71+ ErrorReported ( ErrorGuaranteed ) ,
6972}
7073
7174// 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> {
120123 Err ( PrivateMatch ( ..) ) => false ,
121124 Err ( IllegalSizedBound { .. } ) => true ,
122125 Err ( BadReturnType ) => false ,
126+ Err ( ErrorReported ( _) ) => false ,
123127 }
124128 }
125129
0 commit comments