diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-13 20:06:18 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-13 20:06:18 +0100 |
commit | 8c5c0ef7b910ffafc9c684cb7076149ab79f4bdd (patch) | |
tree | cb85647c41d797b885ac579312043df4b3112648 /crates/hir_ty/src | |
parent | 76530664e7f01091e0d820eb49bf59db1f06115c (diff) | |
parent | ff52167c9a8dd6f99a56a35eae8d634d0ddf1286 (diff) |
Merge #9256
9256: internal: kill diagnostic sink r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r-- | crates/hir_ty/src/diagnostics/expr.rs | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/crates/hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs index 2a211fd8e..b809b96a0 100644 --- a/crates/hir_ty/src/diagnostics/expr.rs +++ b/crates/hir_ty/src/diagnostics/expr.rs | |||
@@ -50,21 +50,13 @@ pub enum BodyValidationDiagnostic { | |||
50 | MissingMatchArms { | 50 | MissingMatchArms { |
51 | match_expr: ExprId, | 51 | match_expr: ExprId, |
52 | }, | 52 | }, |
53 | InternalBailedOut { | ||
54 | pat: PatId, | ||
55 | }, | ||
56 | } | 53 | } |
57 | 54 | ||
58 | impl BodyValidationDiagnostic { | 55 | impl BodyValidationDiagnostic { |
59 | pub fn collect( | 56 | pub fn collect(db: &dyn HirDatabase, owner: DefWithBodyId) -> Vec<BodyValidationDiagnostic> { |
60 | db: &dyn HirDatabase, | ||
61 | owner: DefWithBodyId, | ||
62 | internal_diagnostics: bool, | ||
63 | ) -> Vec<BodyValidationDiagnostic> { | ||
64 | let _p = profile::span("BodyValidationDiagnostic::collect"); | 57 | let _p = profile::span("BodyValidationDiagnostic::collect"); |
65 | let infer = db.infer(owner); | 58 | let infer = db.infer(owner); |
66 | let mut validator = ExprValidator::new(owner, infer.clone()); | 59 | let mut validator = ExprValidator::new(owner, infer.clone()); |
67 | validator.internal_diagnostics = internal_diagnostics; | ||
68 | validator.validate_body(db); | 60 | validator.validate_body(db); |
69 | validator.diagnostics | 61 | validator.diagnostics |
70 | } | 62 | } |
@@ -74,12 +66,11 @@ struct ExprValidator { | |||
74 | owner: DefWithBodyId, | 66 | owner: DefWithBodyId, |
75 | infer: Arc<InferenceResult>, | 67 | infer: Arc<InferenceResult>, |
76 | pub(super) diagnostics: Vec<BodyValidationDiagnostic>, | 68 | pub(super) diagnostics: Vec<BodyValidationDiagnostic>, |
77 | internal_diagnostics: bool, | ||
78 | } | 69 | } |
79 | 70 | ||
80 | impl ExprValidator { | 71 | impl ExprValidator { |
81 | fn new(owner: DefWithBodyId, infer: Arc<InferenceResult>) -> ExprValidator { | 72 | fn new(owner: DefWithBodyId, infer: Arc<InferenceResult>) -> ExprValidator { |
82 | ExprValidator { owner, infer, diagnostics: Vec::new(), internal_diagnostics: false } | 73 | ExprValidator { owner, infer, diagnostics: Vec::new() } |
83 | } | 74 | } |
84 | 75 | ||
85 | fn validate_body(&mut self, db: &dyn HirDatabase) { | 76 | fn validate_body(&mut self, db: &dyn HirDatabase) { |
@@ -308,9 +299,7 @@ impl ExprValidator { | |||
308 | // fit the match expression, we skip this diagnostic. Skipping the entire | 299 | // fit the match expression, we skip this diagnostic. Skipping the entire |
309 | // diagnostic rather than just not including this match arm is preferred | 300 | // diagnostic rather than just not including this match arm is preferred |
310 | // to avoid the chance of false positives. | 301 | // to avoid the chance of false positives. |
311 | if self.internal_diagnostics { | 302 | cov_mark::hit!(validate_match_bailed_out); |
312 | self.diagnostics.push(BodyValidationDiagnostic::InternalBailedOut { pat: arm.pat }) | ||
313 | } | ||
314 | return; | 303 | return; |
315 | } | 304 | } |
316 | 305 | ||