aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/diagnostics/match_check.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-05 16:04:49 +0000
committerGitHub <[email protected]>2021-03-05 16:04:49 +0000
commit6c27c55041953327d341f4e7c705e8887fc4dd50 (patch)
treebcc8bcac74fa61c816986b0635defa7c7512660f /crates/hir_ty/src/diagnostics/match_check.rs
parent25a43e24c81f7b51234fc4e65e5e36ddbe3d60f1 (diff)
parent50e01d2bc7429d718e0783d75458a6a047ee2b70 (diff)
Merge #7870
7870: Use chalk_ir::AdtId r=Veykril a=Veykril It's a bit unfortunate that we got two AdtId's now(technically 3 with the alias in the chalk module but that one won't allow pattern matching), one from hir_def and one from chalk_ir(hir_ty). But the hir_ty/chalk one doesn't leave hir so it shouldn't be that bad I suppose. Though if I see this right this will happen for almost all IDs. I imagine most of the intermediate changes to using chalk ids will turn out not too nice until the refactor is over. Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/diagnostics/match_check.rs')
-rw-r--r--crates/hir_ty/src/diagnostics/match_check.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/hir_ty/src/diagnostics/match_check.rs b/crates/hir_ty/src/diagnostics/match_check.rs
index 86fee0050..04d39c571 100644
--- a/crates/hir_ty/src/diagnostics/match_check.rs
+++ b/crates/hir_ty/src/diagnostics/match_check.rs
@@ -222,12 +222,12 @@ use hir_def::{
222 adt::VariantData, 222 adt::VariantData,
223 body::Body, 223 body::Body,
224 expr::{Expr, Literal, Pat, PatId}, 224 expr::{Expr, Literal, Pat, PatId},
225 AdtId, EnumVariantId, StructId, VariantId, 225 EnumVariantId, StructId, VariantId,
226}; 226};
227use la_arena::Idx; 227use la_arena::Idx;
228use smallvec::{smallvec, SmallVec}; 228use smallvec::{smallvec, SmallVec};
229 229
230use crate::{db::HirDatabase, InferenceResult, Ty}; 230use crate::{db::HirDatabase, AdtId, InferenceResult, Ty};
231 231
232#[derive(Debug, Clone, Copy)] 232#[derive(Debug, Clone, Copy)]
233/// Either a pattern from the source code being analyzed, represented as 233/// Either a pattern from the source code being analyzed, represented as
@@ -627,7 +627,7 @@ pub(super) fn is_useful(
627 // - `!` type 627 // - `!` type
628 // In those cases, no match arm is useful. 628 // In those cases, no match arm is useful.
629 match cx.infer[cx.match_expr].strip_references() { 629 match cx.infer[cx.match_expr].strip_references() {
630 Ty::Adt(AdtId::EnumId(enum_id), ..) => { 630 Ty::Adt(AdtId(hir_def::AdtId::EnumId(enum_id)), ..) => {
631 if cx.db.enum_data(*enum_id).variants.is_empty() { 631 if cx.db.enum_data(*enum_id).variants.is_empty() {
632 return Ok(Usefulness::NotUseful); 632 return Ok(Usefulness::NotUseful);
633 } 633 }