@@ -2060,7 +2060,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
2060
2060
// check upstream for type errors and don't add the obligations to
2061
2061
// begin with in those cases.
2062
2062
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 ( ) {
2064
2064
self . emit_inference_failure_err (
2065
2065
body_id,
2066
2066
span,
@@ -2115,16 +2115,14 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
2115
2115
if impls. len ( ) > 1 && impls. len ( ) < 5 && has_non_region_infer {
2116
2116
self . annotate_source_of_ambiguity ( & mut err, & impls, predicate) ;
2117
2117
} else {
2118
- if self . is_tainted_by_errors ( ) {
2119
- err. delay_as_bug ( ) ;
2118
+ if self . is_tainted_by_errors ( ) . is_some ( ) {
2120
2119
return ;
2121
2120
}
2122
2121
err. note ( & format ! ( "cannot satisfy `{}`" , predicate) ) ;
2123
2122
}
2124
2123
}
2125
2124
_ => {
2126
- if self . is_tainted_by_errors ( ) {
2127
- err. delay_as_bug ( ) ;
2125
+ if self . is_tainted_by_errors ( ) . is_some ( ) {
2128
2126
return ;
2129
2127
}
2130
2128
err. note ( & format ! ( "cannot satisfy `{}`" , predicate) ) ;
@@ -2226,7 +2224,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
2226
2224
] = path. segments
2227
2225
&& data. trait_ref . def_id == * trait_id
2228
2226
&& self . tcx . trait_of_item ( * item_id) == Some ( * trait_id)
2229
- && ! self . is_tainted_by_errors ( )
2227
+ && let None = self . is_tainted_by_errors ( )
2230
2228
{
2231
2229
let ( verb, noun) = match self . tcx . associated_item ( item_id) . kind {
2232
2230
ty:: AssocKind :: Const => ( "refer to the" , "constant" ) ,
@@ -2295,7 +2293,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
2295
2293
// with error messages.
2296
2294
if arg. references_error ( )
2297
2295
|| self . tcx . sess . has_errors ( ) . is_some ( )
2298
- || self . is_tainted_by_errors ( )
2296
+ || self . is_tainted_by_errors ( ) . is_some ( )
2299
2297
{
2300
2298
return ;
2301
2299
}
@@ -2306,7 +2304,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
2306
2304
ty:: PredicateKind :: Subtype ( data) => {
2307
2305
if data. references_error ( )
2308
2306
|| self . tcx . sess . has_errors ( ) . is_some ( )
2309
- || self . is_tainted_by_errors ( )
2307
+ || self . is_tainted_by_errors ( ) . is_some ( )
2310
2308
{
2311
2309
// no need to overload user in such cases
2312
2310
return ;
@@ -2317,7 +2315,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
2317
2315
self . emit_inference_failure_err ( body_id, span, a. into ( ) , ErrorCode :: E0282 , true )
2318
2316
}
2319
2317
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 ( ) {
2321
2319
return ;
2322
2320
}
2323
2321
let subst = data
@@ -2351,7 +2349,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
2351
2349
}
2352
2350
2353
2351
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 ( ) {
2355
2353
return ;
2356
2354
}
2357
2355
let subst = data. walk ( ) . find ( |g| g. is_non_region_infer ( ) ) ;
@@ -2378,7 +2376,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
2378
2376
}
2379
2377
}
2380
2378
_ => {
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 ( ) {
2382
2380
return ;
2383
2381
}
2384
2382
let mut err = struct_span_err ! (
@@ -2422,7 +2420,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
2422
2420
post. sort ( ) ;
2423
2421
post. dedup ( ) ;
2424
2422
2425
- if self . is_tainted_by_errors ( )
2423
+ if self . is_tainted_by_errors ( ) . is_some ( )
2426
2424
&& ( crate_names. len ( ) == 1
2427
2425
&& spans. len ( ) == 0
2428
2426
&& [ "`core`" , "`alloc`" , "`std`" ] . contains ( & crate_names[ 0 ] . as_str ( ) )
0 commit comments