Skip to content

Commit d31905c

Browse files
committed
Remove a has_errors check that doesn't actually prevent noisy follow up errors
1 parent 28f250d commit d31905c

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs

-4
Original file line numberDiff line numberDiff line change
@@ -2720,10 +2720,6 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
27202720
if let Some(e) = self.tainted_by_errors() {
27212721
return e;
27222722
}
2723-
if let Some(e) = self.dcx().has_errors() {
2724-
// no need to overload user in such cases
2725-
return e;
2726-
}
27272723
struct_span_code_err!(
27282724
self.dcx(),
27292725
span,

tests/ui/traits/next-solver/specialization-transmute.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ impl<T> Default for T {
1414
default type Id = T; //~ ERROR type annotations needed
1515
// This will be fixed by #111994
1616
fn intu(&self) -> &Self::Id {
17+
//~^ ERROR type annotations needed
1718
self
1819
}
1920
}

tests/ui/traits/next-solver/specialization-transmute.stderr

+9-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,19 @@ LL | #![feature(specialization)]
1010

1111
error: cannot normalize `<T as Default>::Id`
1212

13+
error[E0284]: type annotations needed: cannot satisfy `<T as Default>::Id == _`
14+
--> $DIR/specialization-transmute.rs:16:23
15+
|
16+
LL | fn intu(&self) -> &Self::Id {
17+
| ^^^^^^^^^ cannot satisfy `<T as Default>::Id == _`
18+
1319
error[E0282]: type annotations needed
1420
--> $DIR/specialization-transmute.rs:14:23
1521
|
1622
LL | default type Id = T;
1723
| ^ cannot infer type for associated type `<T as Default>::Id`
1824

19-
error: aborting due to 2 previous errors; 1 warning emitted
25+
error: aborting due to 3 previous errors; 1 warning emitted
2026

21-
For more information about this error, try `rustc --explain E0282`.
27+
Some errors have detailed explanations: E0282, E0284.
28+
For more information about an error, try `rustc --explain E0282`.

0 commit comments

Comments
 (0)