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