aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/infer/coerce.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/infer/coerce.rs')
-rw-r--r--crates/ra_hir_ty/src/infer/coerce.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/ra_hir_ty/src/infer/coerce.rs b/crates/ra_hir_ty/src/infer/coerce.rs
index 95ac3c713..959b1e212 100644
--- a/crates/ra_hir_ty/src/infer/coerce.rs
+++ b/crates/ra_hir_ty/src/infer/coerce.rs
@@ -7,13 +7,11 @@
7use hir_def::{lang_item::LangItemTarget, type_ref::Mutability}; 7use hir_def::{lang_item::LangItemTarget, type_ref::Mutability};
8use test_utils::tested_by; 8use test_utils::tested_by;
9 9
10use crate::{ 10use crate::{autoderef, traits::Solution, Obligation, Substs, TraitRef, Ty, TypeCtor};
11 autoderef, db::HirDatabase, traits::Solution, Obligation, Substs, TraitRef, Ty, TypeCtor,
12};
13 11
14use super::{unify::TypeVarValue, InEnvironment, InferTy, InferenceContext}; 12use super::{unify::TypeVarValue, InEnvironment, InferTy, InferenceContext};
15 13
16impl<'a, D: HirDatabase> InferenceContext<'a, D> { 14impl<'a> InferenceContext<'a> {
17 /// Unify two types, but may coerce the first one to the second one 15 /// Unify two types, but may coerce the first one to the second one
18 /// using "implicit coercion rules" if needed. 16 /// using "implicit coercion rules" if needed.
19 pub(super) fn coerce(&mut self, from_ty: &Ty, to_ty: &Ty) -> bool { 17 pub(super) fn coerce(&mut self, from_ty: &Ty, to_ty: &Ty) -> bool {
@@ -126,7 +124,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
126 _ => return None, 124 _ => return None,
127 }; 125 };
128 126
129 let generic_params = crate::utils::generics(self.db, coerce_unsized_trait.into()); 127 let generic_params = crate::utils::generics(self.db.upcast(), coerce_unsized_trait.into());
130 if generic_params.len() != 2 { 128 if generic_params.len() != 2 {
131 // The CoerceUnsized trait should have two generic params: Self and T. 129 // The CoerceUnsized trait should have two generic params: Self and T.
132 return None; 130 return None;