@@ -2060,7 +2060,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
20602060 // check upstream for type errors and don't add the obligations to
20612061 // begin with in those cases.
20622062 if self . tcx . lang_items ( ) . sized_trait ( ) == Some ( trait_ref. def_id ( ) ) {
2063- if let None = self . is_tainted_by_errors ( ) {
2063+ if let None = self . tainted_by_errors ( ) {
20642064 self . emit_inference_failure_err (
20652065 body_id,
20662066 span,
@@ -2115,14 +2115,16 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
21152115 if impls. len ( ) > 1 && impls. len ( ) < 5 && has_non_region_infer {
21162116 self . annotate_source_of_ambiguity ( & mut err, & impls, predicate) ;
21172117 } else {
2118- if self . is_tainted_by_errors ( ) . is_some ( ) {
2118+ if self . tainted_by_errors ( ) . is_some ( ) {
2119+ err. cancel ( ) ;
21192120 return ;
21202121 }
21212122 err. note ( & format ! ( "cannot satisfy `{}`" , predicate) ) ;
21222123 }
21232124 }
21242125 _ => {
2125- if self . is_tainted_by_errors ( ) . is_some ( ) {
2126+ if self . tainted_by_errors ( ) . is_some ( ) {
2127+ err. cancel ( ) ;
21262128 return ;
21272129 }
21282130 err. note ( & format ! ( "cannot satisfy `{}`" , predicate) ) ;
@@ -2224,7 +2226,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
22242226 ] = path. segments
22252227 && data. trait_ref . def_id == * trait_id
22262228 && self . tcx . trait_of_item ( * item_id) == Some ( * trait_id)
2227- && let None = self . is_tainted_by_errors ( )
2229+ && let None = self . tainted_by_errors ( )
22282230 {
22292231 let ( verb, noun) = match self . tcx . associated_item ( item_id) . kind {
22302232 ty:: AssocKind :: Const => ( "refer to the" , "constant" ) ,
@@ -2293,7 +2295,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
22932295 // with error messages.
22942296 if arg. references_error ( )
22952297 || self . tcx . sess . has_errors ( ) . is_some ( )
2296- || self . is_tainted_by_errors ( ) . is_some ( )
2298+ || self . tainted_by_errors ( ) . is_some ( )
22972299 {
22982300 return ;
22992301 }
@@ -2304,7 +2306,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
23042306 ty:: PredicateKind :: Subtype ( data) => {
23052307 if data. references_error ( )
23062308 || self . tcx . sess . has_errors ( ) . is_some ( )
2307- || self . is_tainted_by_errors ( ) . is_some ( )
2309+ || self . tainted_by_errors ( ) . is_some ( )
23082310 {
23092311 // no need to overload user in such cases
23102312 return ;
@@ -2315,7 +2317,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
23152317 self . emit_inference_failure_err ( body_id, span, a. into ( ) , ErrorCode :: E0282 , true )
23162318 }
23172319 ty:: PredicateKind :: Projection ( data) => {
2318- if predicate. references_error ( ) || self . is_tainted_by_errors ( ) . is_some ( ) {
2320+ if predicate. references_error ( ) || self . tainted_by_errors ( ) . is_some ( ) {
23192321 return ;
23202322 }
23212323 let subst = data
@@ -2349,7 +2351,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
23492351 }
23502352
23512353 ty:: PredicateKind :: ConstEvaluatable ( data) => {
2352- if predicate. references_error ( ) || self . is_tainted_by_errors ( ) . is_some ( ) {
2354+ if predicate. references_error ( ) || self . tainted_by_errors ( ) . is_some ( ) {
23532355 return ;
23542356 }
23552357 let subst = data. walk ( ) . find ( |g| g. is_non_region_infer ( ) ) ;
@@ -2376,7 +2378,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
23762378 }
23772379 }
23782380 _ => {
2379- if self . tcx . sess . has_errors ( ) . is_some ( ) || self . is_tainted_by_errors ( ) . is_some ( ) {
2381+ if self . tcx . sess . has_errors ( ) . is_some ( ) || self . tainted_by_errors ( ) . is_some ( ) {
23802382 return ;
23812383 }
23822384 let mut err = struct_span_err ! (
@@ -2420,7 +2422,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
24202422 post. sort ( ) ;
24212423 post. dedup ( ) ;
24222424
2423- if self . is_tainted_by_errors ( ) . is_some ( )
2425+ if self . tainted_by_errors ( ) . is_some ( )
24242426 && ( crate_names. len ( ) == 1
24252427 && spans. len ( ) == 0
24262428 && [ "`core`" , "`alloc`" , "`std`" ] . contains ( & crate_names[ 0 ] . as_str ( ) )
0 commit comments