Skip to content

Commit 28f250d

Browse files
committed
Remove a has_errors check that does not prevent follow up error noise
1 parent a6b1e43 commit 28f250d

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

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

-4
Original file line numberDiff line numberDiff line change
@@ -2641,10 +2641,6 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
26412641
if let Some(e) = self.tainted_by_errors() {
26422642
return e;
26432643
}
2644-
if let Some(e) = self.dcx().has_errors() {
2645-
// no need to overload user in such cases
2646-
return e;
2647-
}
26482644
let SubtypePredicate { a_is_expected: _, a, b } = data;
26492645
// both must be type variables, or the other would've been instantiated
26502646
assert!(a.is_ty_var() && b.is_ty_var());

tests/ui/generic-const-items/parameter-defaults.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ error[E0282]: type annotations needed for `Option<T>`
88
--> $DIR/parameter-defaults.rs:13:9
99
|
1010
LL | let _ = NONE;
11-
| ^
11+
| ^ ---- type must be known at this point
1212
|
1313
help: consider giving this pattern a type, where the type for type parameter `T` is specified
1414
|

tests/ui/parser/issues/issue-89574.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
fn main() {
22
const EMPTY_ARRAY = [];
33
//~^ missing type for `const` item
4+
//~| ERROR type annotations needed
5+
//~| ERROR type annotations needed
46
}
+16-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1+
error[E0282]: type annotations needed
2+
--> $DIR/issue-89574.rs:2:25
3+
|
4+
LL | const EMPTY_ARRAY = [];
5+
| ^^ cannot infer type
6+
17
error: missing type for `const` item
28
--> $DIR/issue-89574.rs:2:22
39
|
410
LL | const EMPTY_ARRAY = [];
511
| ^ help: provide a type for the item: `: <type>`
612

7-
error: aborting due to 1 previous error
13+
error[E0282]: type annotations needed
14+
--> $DIR/issue-89574.rs:2:25
15+
|
16+
LL | const EMPTY_ARRAY = [];
17+
| ^^ cannot infer type
18+
|
19+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
20+
21+
error: aborting due to 3 previous errors
822

23+
For more information about this error, try `rustc --explain E0282`.

tests/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ error[E0282]: type annotations needed for `Vec<_>`
4141
--> $DIR/missing-closing-angle-bracket-eq-constraint.rs:7:7
4242
|
4343
LL | let v : Vec<(u32,_) = vec![];
44-
| ^
44+
| ^ ------ type must be known at this point
4545
|
4646
help: consider giving `v` an explicit type, where the placeholders `_` are specified
4747
|
@@ -52,7 +52,7 @@ error[E0282]: type annotations needed for `Vec<_>`
5252
--> $DIR/missing-closing-angle-bracket-eq-constraint.rs:18:7
5353
|
5454
LL | let v : Vec<'a = vec![];
55-
| ^
55+
| ^ ------ type must be known at this point
5656
|
5757
help: consider giving `v` an explicit type, where the placeholders `_` are specified
5858
|

0 commit comments

Comments
 (0)