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.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/crates/ra_hir_ty/src/infer/coerce.rs b/crates/ra_hir_ty/src/infer/coerce.rs
index f68a1439f..fb6a51b12 100644
--- a/crates/ra_hir_ty/src/infer/coerce.rs
+++ b/crates/ra_hir_ty/src/infer/coerce.rs
@@ -26,7 +26,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
26 /// Note that it is only possible that one type are coerced to another. 26 /// Note that it is only possible that one type are coerced to another.
27 /// Coercing both types to another least upper bound type is not possible in rustc, 27 /// Coercing both types to another least upper bound type is not possible in rustc,
28 /// which will simply result in "incompatible types" error. 28 /// which will simply result in "incompatible types" error.
29 pub(super) fn coerce_merge_branch<'t>(&mut self, ty1: &Ty, ty2: &Ty) -> Ty { 29 pub(super) fn coerce_merge_branch(&mut self, ty1: &Ty, ty2: &Ty) -> Ty {
30 if self.coerce(ty1, ty2) { 30 if self.coerce(ty1, ty2) {
31 ty2.clone() 31 ty2.clone()
32 } else if self.coerce(ty2, ty1) { 32 } else if self.coerce(ty2, ty1) {
@@ -44,10 +44,8 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
44 resolver: &Resolver, 44 resolver: &Resolver,
45 ) -> FxHashMap<(TypeCtor, TypeCtor), usize> { 45 ) -> FxHashMap<(TypeCtor, TypeCtor), usize> {
46 let krate = resolver.krate().unwrap(); 46 let krate = resolver.krate().unwrap();
47 let impls = match db.lang_item(krate.into(), "coerce_unsized".into()) { 47 let impls = match db.lang_item(krate, "coerce_unsized".into()) {
48 Some(LangItemTarget::TraitId(trait_)) => { 48 Some(LangItemTarget::TraitId(trait_)) => db.impls_for_trait(krate, trait_),
49 db.impls_for_trait(krate.into(), trait_.into())
50 }
51 _ => return FxHashMap::default(), 49 _ => return FxHashMap::default(),
52 }; 50 };
53 51
@@ -254,15 +252,14 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
254 let unsize_generic_index = { 252 let unsize_generic_index = {
255 let mut index = None; 253 let mut index = None;
256 let mut multiple_param = false; 254 let mut multiple_param = false;
257 field_tys[last_field_id].value.walk(&mut |ty| match ty { 255 field_tys[last_field_id].value.walk(&mut |ty| {
258 &Ty::Bound(idx) => { 256 if let &Ty::Bound(idx) = ty {
259 if index.is_none() { 257 if index.is_none() {
260 index = Some(idx); 258 index = Some(idx);
261 } else if Some(idx) != index { 259 } else if Some(idx) != index {
262 multiple_param = true; 260 multiple_param = true;
263 } 261 }
264 } 262 }
265 _ => {}
266 }); 263 });
267 264
268 if multiple_param { 265 if multiple_param {