From a838a60caaa5351d7543bcbebb1aa976b0b73f39 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Thu, 8 Apr 2021 13:51:04 +0200 Subject: Fix missing match arms --- crates/hir/src/lib.rs | 4 +++- crates/hir_ty/src/display.rs | 18 ++++++++++++++++-- crates/hir_ty/src/infer/unify.rs | 1 + crates/hir_ty/src/traits.rs | 1 + crates/hir_ty/src/walk.rs | 2 ++ 5 files changed, 23 insertions(+), 3 deletions(-) (limited to 'crates') diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 0afc06906..817a01db1 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -1903,7 +1903,9 @@ impl Type { | TyKind::Dyn(_) | TyKind::Function(_) | TyKind::Alias(_) - | TyKind::Foreign(_) => false, + | TyKind::Foreign(_) + | TyKind::Generator(..) + | TyKind::GeneratorWitness(..) => false, } } } diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index e0ca96c6d..d7a3977e5 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs @@ -287,6 +287,8 @@ impl HirDisplay for GenericArg { fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> { match self.interned() { crate::GenericArgData::Ty(ty) => ty.hir_fmt(f), + crate::GenericArgData::Lifetime(lt) => lt.hir_fmt(f), + crate::GenericArgData::Const(c) => c.hir_fmt(f), } } } @@ -664,6 +666,8 @@ impl HirDisplay for Ty { write!(f, "{{unknown}}")?; } TyKind::InferenceVar(..) => write!(f, "_")?, + TyKind::Generator(..) => write!(f, "{{generator}}")?, + TyKind::GeneratorWitness(..) => write!(f, "{{generator witness}}")?, } Ok(()) } @@ -741,7 +745,7 @@ fn write_bounds_like_dyn_trait( if !first { write!(f, " + ")?; } - // We assume that the self type is $0 (i.e. the + // We assume that the self type is ^0.0 (i.e. the // existential) here, which is the only thing that's // possible in actual Rust, and hence don't print it write!(f, "{}", f.db.trait_data(trait_).name)?; @@ -783,6 +787,10 @@ fn write_bounds_like_dyn_trait( } ty.hir_fmt(f)?; } + + // FIXME implement these + WhereClause::LifetimeOutlives(_) => {} + WhereClause::TypeOutlives(_) => {} } first = false; } @@ -837,6 +845,10 @@ impl HirDisplay for WhereClause { ty.hir_fmt(f)?; } WhereClause::AliasEq(_) => write!(f, "{{error}}")?, + + // FIXME implement these + WhereClause::TypeOutlives(..) => {} + WhereClause::LifetimeOutlives(..) => {} } Ok(()) } @@ -881,9 +893,11 @@ impl HirDisplay for DomainGoal { DomainGoal::Holds(wc) => { write!(f, "Holds(")?; wc.hir_fmt(f)?; - write!(f, ")") + write!(f, ")")?; } + _ => write!(f, "?")?, } + Ok(()) } } diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index ffa324b6d..648af4ebf 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs @@ -116,6 +116,7 @@ impl<'a, 'b> Canonicalizer<'a, 'b> { DomainGoal::Holds(wc) => { DomainGoal::Holds(self.do_canonicalize(wc, DebruijnIndex::INNERMOST)) } + _ => unimplemented!(), }; self.into_canonicalized(InEnvironment { goal: result, environment: obligation.environment }) } diff --git a/crates/hir_ty/src/traits.rs b/crates/hir_ty/src/traits.rs index cc1d2ca18..de1d37e17 100644 --- a/crates/hir_ty/src/traits.rs +++ b/crates/hir_ty/src/traits.rs @@ -81,6 +81,7 @@ pub(crate) fn trait_solve_query( db.trait_data(it.hir_trait_id()).name.to_string() } DomainGoal::Holds(WhereClause::AliasEq(_)) => "alias_eq".to_string(), + _ => "??".to_string(), }); log::info!("trait_solve_query({})", goal.value.goal.display(db)); diff --git a/crates/hir_ty/src/walk.rs b/crates/hir_ty/src/walk.rs index 28875dbe0..57343fd61 100644 --- a/crates/hir_ty/src/walk.rs +++ b/crates/hir_ty/src/walk.rs @@ -93,6 +93,7 @@ impl TypeWalk for GenericArg { GenericArgData::Ty(ty) => { ty.walk(f); } + _ => {} } } } @@ -122,6 +123,7 @@ impl TypeWalk for WhereClause { match self { WhereClause::Implemented(trait_ref) => trait_ref.walk(f), WhereClause::AliasEq(alias_eq) => alias_eq.walk(f), + _ => {} } } } -- cgit v1.2.3