diff options
Diffstat (limited to 'crates/hir_ty/src/infer/unify.rs')
-rw-r--r-- | crates/hir_ty/src/infer/unify.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index 75e04e8b5..278127c69 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! Unification and canonicalization logic. | 1 | //! Unification and canonicalization logic. |
2 | 2 | ||
3 | use std::{borrow::Cow, fmt, mem, sync::Arc}; | 3 | use std::{fmt, mem, sync::Arc}; |
4 | 4 | ||
5 | use chalk_ir::{ | 5 | use chalk_ir::{ |
6 | cast::Cast, fold::Fold, interner::HasInterner, zip::Zip, FloatTy, IntTy, TyVariableKind, | 6 | cast::Cast, fold::Fold, interner::HasInterner, zip::Zip, FloatTy, IntTy, TyVariableKind, |
@@ -340,11 +340,8 @@ impl<'a> InferenceTable<'a> { | |||
340 | 340 | ||
341 | /// If `ty` is a type variable with known type, returns that type; | 341 | /// If `ty` is a type variable with known type, returns that type; |
342 | /// otherwise, return ty. | 342 | /// otherwise, return ty. |
343 | // FIXME this could probably just return Ty | 343 | pub(crate) fn resolve_ty_shallow(&mut self, ty: &Ty) -> Ty { |
344 | pub(crate) fn resolve_ty_shallow<'b>(&mut self, ty: &'b Ty) -> Cow<'b, Ty> { | 344 | self.var_unification_table.normalize_ty_shallow(&Interner, ty).unwrap_or_else(|| ty.clone()) |
345 | self.var_unification_table | ||
346 | .normalize_ty_shallow(&Interner, ty) | ||
347 | .map_or(Cow::Borrowed(ty), Cow::Owned) | ||
348 | } | 345 | } |
349 | 346 | ||
350 | /// Resolves the type as far as currently possible, replacing type variables | 347 | /// Resolves the type as far as currently possible, replacing type variables |