@@ -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 ! self . is_tainted_by_errors ( ) {
2063+ if let None = self . is_tainted_by_errors ( ) {
20642064 self . emit_inference_failure_err (
20652065 body_id,
20662066 span,
@@ -2115,16 +2115,14 @@ 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 ( ) {
2119- err. delay_as_bug ( ) ;
2118+ if self . is_tainted_by_errors ( ) . is_some ( ) {
21202119 return ;
21212120 }
21222121 err. note ( & format ! ( "cannot satisfy `{}`" , predicate) ) ;
21232122 }
21242123 }
21252124 _ => {
2126- if self . is_tainted_by_errors ( ) {
2127- err. delay_as_bug ( ) ;
2125+ if self . is_tainted_by_errors ( ) . is_some ( ) {
21282126 return ;
21292127 }
21302128 err. note ( & format ! ( "cannot satisfy `{}`" , predicate) ) ;
@@ -2226,7 +2224,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
22262224 ] = path. segments
22272225 && data. trait_ref . def_id == * trait_id
22282226 && self . tcx . trait_of_item ( * item_id) == Some ( * trait_id)
2229- && ! self . is_tainted_by_errors ( )
2227+ && let None = self . is_tainted_by_errors ( )
22302228 {
22312229 let ( verb, noun) = match self . tcx . associated_item ( item_id) . kind {
22322230 ty:: AssocKind :: Const => ( "refer to the" , "constant" ) ,
@@ -2295,7 +2293,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
22952293 // with error messages.
22962294 if arg. references_error ( )
22972295 || self . tcx . sess . has_errors ( ) . is_some ( )
2298- || self . is_tainted_by_errors ( )
2296+ || self . is_tainted_by_errors ( ) . is_some ( )
22992297 {
23002298 return ;
23012299 }
@@ -2306,7 +2304,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
23062304 ty:: PredicateKind :: Subtype ( data) => {
23072305 if data. references_error ( )
23082306 || self . tcx . sess . has_errors ( ) . is_some ( )
2309- || self . is_tainted_by_errors ( )
2307+ || self . is_tainted_by_errors ( ) . is_some ( )
23102308 {
23112309 // no need to overload user in such cases
23122310 return ;
@@ -2317,7 +2315,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
23172315 self . emit_inference_failure_err ( body_id, span, a. into ( ) , ErrorCode :: E0282 , true )
23182316 }
23192317 ty:: PredicateKind :: Projection ( data) => {
2320- if predicate. references_error ( ) || self . is_tainted_by_errors ( ) {
2318+ if predicate. references_error ( ) || self . is_tainted_by_errors ( ) . is_some ( ) {
23212319 return ;
23222320 }
23232321 let subst = data
@@ -2351,7 +2349,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
23512349 }
23522350
23532351 ty:: PredicateKind :: ConstEvaluatable ( data) => {
2354- if predicate. references_error ( ) || self . is_tainted_by_errors ( ) {
2352+ if predicate. references_error ( ) || self . is_tainted_by_errors ( ) . is_some ( ) {
23552353 return ;
23562354 }
23572355 let subst = data. walk ( ) . find ( |g| g. is_non_region_infer ( ) ) ;
@@ -2378,7 +2376,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
23782376 }
23792377 }
23802378 _ => {
2381- if self . tcx . sess . has_errors ( ) . is_some ( ) || self . is_tainted_by_errors ( ) {
2379+ if self . tcx . sess . has_errors ( ) . is_some ( ) || self . is_tainted_by_errors ( ) . is_some ( ) {
23822380 return ;
23832381 }
23842382 let mut err = struct_span_err ! (
@@ -2422,7 +2420,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
24222420 post. sort ( ) ;
24232421 post. dedup ( ) ;
24242422
2425- if self . is_tainted_by_errors ( )
2423+ if self . is_tainted_by_errors ( ) . is_some ( )
24262424 && ( crate_names. len ( ) == 1
24272425 && spans. len ( ) == 0
24282426 && [ "`core`" , "`alloc`" , "`std`" ] . contains ( & crate_names[ 0 ] . as_str ( ) )
0 commit comments