diff --git a/crates/hir-ty/src/db.rs b/crates/hir-ty/src/db.rs index dd5639f00d2..69283e55a4c 100644 --- a/crates/hir-ty/src/db.rs +++ b/crates/hir-ty/src/db.rs @@ -156,7 +156,7 @@ fn normalize_projection( &self, projection: crate::ProjectionTy, env: Arc, - ) -> Option; + ) -> Ty; #[salsa::invoke(trait_solve_wait)] #[salsa::transparent] diff --git a/crates/hir-ty/src/traits.rs b/crates/hir-ty/src/traits.rs index aaff894b34f..372c3a3cca6 100644 --- a/crates/hir-ty/src/traits.rs +++ b/crates/hir-ty/src/traits.rs @@ -69,10 +69,10 @@ pub(crate) fn normalize_projection_query( db: &dyn HirDatabase, projection: ProjectionTy, env: Arc, -) -> Option { - let mut table = InferenceTable::new(db, env.clone()); +) -> Ty { + let mut table = InferenceTable::new(db, env); let ty = table.normalize_projection_ty(projection); - Some(table.resolve_completely(ty)) + table.resolve_completely(ty) } /// Solve a trait goal using Chalk. diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index b5974a0cfc9..d2717c56654 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -2892,7 +2892,12 @@ pub fn normalize_trait_assoc_type( }) .build(); - db.normalize_projection(projection, self.env.clone()).map(|ty| self.derived(ty)) + let ty = db.normalize_projection(projection, self.env.clone()); + if ty.is_unknown() { + None + } else { + Some(self.derived(ty)) + } } pub fn is_copy(&self, db: &dyn HirDatabase) -> bool {