@@ -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} ;
@@ -46,26 +46,29 @@ pub(crate) struct MethodCallee<'tcx> {
46
46
47
47
#[ derive( Debug ) ]
48
48
pub ( crate ) enum MethodError < ' tcx > {
49
- // Did not find an applicable method, but we did find various near-misses that may work.
49
+ /// Did not find an applicable method, but we did find various near-misses that may work.
50
50
NoMatch ( NoMatchData < ' tcx > ) ,
51
51
52
- // Multiple methods might apply.
52
+ /// Multiple methods might apply.
53
53
Ambiguity ( Vec < CandidateSource > ) ,
54
54
55
- // Found an applicable method, but it is not visible. The third argument contains a list of
56
- // not-in-scope traits which may work.
55
+ /// Found an applicable method, but it is not visible. The third argument contains a list of
56
+ /// not-in-scope traits which may work.
57
57
PrivateMatch ( DefKind , DefId , Vec < DefId > ) ,
58
58
59
- // Found a `Self: Sized` bound where `Self` is a trait object.
59
+ /// Found a `Self: Sized` bound where `Self` is a trait object.
60
60
IllegalSizedBound {
61
61
candidates : Vec < DefId > ,
62
62
needs_mut : bool ,
63
63
bound_span : Span ,
64
64
self_expr : & ' tcx hir:: Expr < ' tcx > ,
65
65
} ,
66
66
67
- // Found a match, but the return type is wrong
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