Skip to content

Commit

Permalink
Remove a has_errors check that does not prevent follow up error noise
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Jan 31, 2024
1 parent a6b1e43 commit 28f250d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2641,10 +2641,6 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
if let Some(e) = self.tainted_by_errors() {
return e;
}
if let Some(e) = self.dcx().has_errors() {
// no need to overload user in such cases
return e;
}
let SubtypePredicate { a_is_expected: _, a, b } = data;
// both must be type variables, or the other would've been instantiated
assert!(a.is_ty_var() && b.is_ty_var());
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/generic-const-items/parameter-defaults.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ error[E0282]: type annotations needed for `Option<T>`
--> $DIR/parameter-defaults.rs:13:9
|
LL | let _ = NONE;
| ^
| ^ ---- type must be known at this point
|
help: consider giving this pattern a type, where the type for type parameter `T` is specified
|
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/parser/issues/issue-89574.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
fn main() {
const EMPTY_ARRAY = [];
//~^ missing type for `const` item
//~| ERROR type annotations needed
//~| ERROR type annotations needed
}
17 changes: 16 additions & 1 deletion tests/ui/parser/issues/issue-89574.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
error[E0282]: type annotations needed
--> $DIR/issue-89574.rs:2:25
|
LL | const EMPTY_ARRAY = [];
| ^^ cannot infer type

error: missing type for `const` item
--> $DIR/issue-89574.rs:2:22
|
LL | const EMPTY_ARRAY = [];
| ^ help: provide a type for the item: `: <type>`

error: aborting due to 1 previous error
error[E0282]: type annotations needed
--> $DIR/issue-89574.rs:2:25
|
LL | const EMPTY_ARRAY = [];
| ^^ cannot infer type
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0282`.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ error[E0282]: type annotations needed for `Vec<_>`
--> $DIR/missing-closing-angle-bracket-eq-constraint.rs:7:7
|
LL | let v : Vec<(u32,_) = vec![];
| ^
| ^ ------ type must be known at this point
|
help: consider giving `v` an explicit type, where the placeholders `_` are specified
|
Expand All @@ -52,7 +52,7 @@ error[E0282]: type annotations needed for `Vec<_>`
--> $DIR/missing-closing-angle-bracket-eq-constraint.rs:18:7
|
LL | let v : Vec<'a = vec![];
| ^
| ^ ------ type must be known at this point
|
help: consider giving `v` an explicit type, where the placeholders `_` are specified
|
Expand Down

0 comments on commit 28f250d

Please sign in to comment.