Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/infer.rs')
| -rw-r--r-- | crates/hir-ty/src/infer.rs | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/crates/hir-ty/src/infer.rs b/crates/hir-ty/src/infer.rs index 72498681ac..041799be96 100644 --- a/crates/hir-ty/src/infer.rs +++ b/crates/hir-ty/src/infer.rs @@ -55,8 +55,7 @@ use stdx::never; use triomphe::Arc; use crate::{ - ImplTraitId, IncorrectGenericsLenKind, Interner, PathLoweringDiagnostic, TargetFeatures, - TraitEnvironment, + ImplTraitId, IncorrectGenericsLenKind, PathLoweringDiagnostic, TargetFeatures, db::{HirDatabase, InternedClosureId, InternedOpaqueTyId}, generics::Generics, infer::{ @@ -77,7 +76,7 @@ use crate::{ DefineOpaqueTypes, traits::{Obligation, ObligationCause}, }, - mapping::{ChalkToNextSolver, NextSolverToChalk}, + mapping::ChalkToNextSolver, }, traits::FnTrait, utils::TargetFeatureIsSafeInTarget, @@ -166,31 +165,6 @@ pub(crate) fn infer_cycle_result( }) } -/// Fully normalize all the types found within `ty` in context of `owner` body definition. -/// -/// This is appropriate to use only after type-check: it assumes -/// that normalization will succeed, for example. -#[tracing::instrument(level = "debug", skip(db))] -pub(crate) fn normalize( - db: &dyn HirDatabase, - trait_env: Arc<TraitEnvironment<'_>>, - ty: crate::Ty, -) -> crate::Ty { - // FIXME: TypeFlags::HAS_CT_PROJECTION is not implemented in chalk, so TypeFlags::HAS_PROJECTION only - // works for the type case, so we check array unconditionally. Remove the array part - // when the bug in chalk becomes fixed. - if !ty.data(Interner).flags.intersects(crate::TypeFlags::HAS_PROJECTION) - && !matches!(ty.kind(Interner), crate::TyKind::Array(..)) - { - return ty; - } - let mut table = unify::InferenceTable::new(db, trait_env); - - let ty_with_vars = table.normalize_associated_types_in(ty.to_nextsolver(table.interner())); - table.select_obligations_where_possible(); - table.resolve_completely(ty_with_vars).to_chalk(table.interner()) -} - /// Binding modes inferred for patterns. /// <https://doc.rust-lang.org/reference/patterns.html#binding-modes> #[derive(Copy, Clone, Debug, Eq, PartialEq, Default)] |