Remove a has_errors check that does not prevent follow up error noise

This commit is contained in:
Oli Scherer 2024-01-31 16:27:58 +00:00
parent a6b1e433da
commit 28f250d6a6
5 changed files with 21 additions and 8 deletions

View File

@ -2641,10 +2641,6 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
if let Some(e) = self.tainted_by_errors() { if let Some(e) = self.tainted_by_errors() {
return e; 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; let SubtypePredicate { a_is_expected: _, a, b } = data;
// both must be type variables, or the other would've been instantiated // both must be type variables, or the other would've been instantiated
assert!(a.is_ty_var() && b.is_ty_var()); assert!(a.is_ty_var() && b.is_ty_var());

View File

@ -8,7 +8,7 @@ error[E0282]: type annotations needed for `Option<T>`
--> $DIR/parameter-defaults.rs:13:9 --> $DIR/parameter-defaults.rs:13:9
| |
LL | let _ = NONE; 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 help: consider giving this pattern a type, where the type for type parameter `T` is specified
| |

View File

@ -1,4 +1,6 @@
fn main() { fn main() {
const EMPTY_ARRAY = []; const EMPTY_ARRAY = [];
//~^ missing type for `const` item //~^ missing type for `const` item
//~| ERROR type annotations needed
//~| ERROR type annotations needed
} }

View File

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

View File

@ -41,7 +41,7 @@ error[E0282]: type annotations needed for `Vec<_>`
--> $DIR/missing-closing-angle-bracket-eq-constraint.rs:7:7 --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:7:7
| |
LL | let v : Vec<(u32,_) = vec![]; 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 help: consider giving `v` an explicit type, where the placeholders `_` are specified
| |
@ -52,7 +52,7 @@ error[E0282]: type annotations needed for `Vec<_>`
--> $DIR/missing-closing-angle-bracket-eq-constraint.rs:18:7 --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:18:7
| |
LL | let v : Vec<'a = vec![]; 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 help: consider giving `v` an explicit type, where the placeholders `_` are specified
| |