diff options
Diffstat (limited to 'crates/hir_ty/src/method_resolution.rs')
-rw-r--r-- | crates/hir_ty/src/method_resolution.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index 6d65d3eb9..ee725fd46 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs | |||
@@ -19,9 +19,10 @@ use crate::{ | |||
19 | db::HirDatabase, | 19 | db::HirDatabase, |
20 | from_foreign_def_id, | 20 | from_foreign_def_id, |
21 | primitive::{self, FloatTy, IntTy, UintTy}, | 21 | primitive::{self, FloatTy, IntTy, UintTy}, |
22 | static_lifetime, | ||
22 | utils::all_super_traits, | 23 | utils::all_super_traits, |
23 | AdtId, Canonical, CanonicalVarKinds, DebruijnIndex, FnPointer, FnSig, ForeignDefId, | 24 | AdtId, Canonical, CanonicalVarKinds, DebruijnIndex, FnPointer, FnSig, ForeignDefId, |
24 | InEnvironment, Interner, Scalar, Substitution, TraitEnvironment, Ty, TyBuilder, TyKind, | 25 | InEnvironment, Interner, Scalar, Substitution, TraitEnvironment, Ty, TyBuilder, TyExt, TyKind, |
25 | TypeWalk, | 26 | TypeWalk, |
26 | }; | 27 | }; |
27 | 28 | ||
@@ -453,7 +454,8 @@ fn iterate_method_candidates_with_autoref( | |||
453 | } | 454 | } |
454 | let refed = Canonical { | 455 | let refed = Canonical { |
455 | binders: deref_chain[0].binders.clone(), | 456 | binders: deref_chain[0].binders.clone(), |
456 | value: TyKind::Ref(Mutability::Not, deref_chain[0].value.clone()).intern(&Interner), | 457 | value: TyKind::Ref(Mutability::Not, static_lifetime(), deref_chain[0].value.clone()) |
458 | .intern(&Interner), | ||
457 | }; | 459 | }; |
458 | if iterate_method_candidates_by_receiver( | 460 | if iterate_method_candidates_by_receiver( |
459 | &refed, | 461 | &refed, |
@@ -470,7 +472,8 @@ fn iterate_method_candidates_with_autoref( | |||
470 | } | 472 | } |
471 | let ref_muted = Canonical { | 473 | let ref_muted = Canonical { |
472 | binders: deref_chain[0].binders.clone(), | 474 | binders: deref_chain[0].binders.clone(), |
473 | value: TyKind::Ref(Mutability::Mut, deref_chain[0].value.clone()).intern(&Interner), | 475 | value: TyKind::Ref(Mutability::Mut, static_lifetime(), deref_chain[0].value.clone()) |
476 | .intern(&Interner), | ||
474 | }; | 477 | }; |
475 | if iterate_method_candidates_by_receiver( | 478 | if iterate_method_candidates_by_receiver( |
476 | &ref_muted, | 479 | &ref_muted, |
@@ -839,7 +842,9 @@ fn autoderef_method_receiver( | |||
839 | ) -> Vec<Canonical<Ty>> { | 842 | ) -> Vec<Canonical<Ty>> { |
840 | let mut deref_chain: Vec<_> = autoderef::autoderef(db, Some(krate), ty).collect(); | 843 | let mut deref_chain: Vec<_> = autoderef::autoderef(db, Some(krate), ty).collect(); |
841 | // As a last step, we can do array unsizing (that's the only unsizing that rustc does for method receivers!) | 844 | // As a last step, we can do array unsizing (that's the only unsizing that rustc does for method receivers!) |
842 | if let Some(TyKind::Array(parameters)) = deref_chain.last().map(|ty| ty.value.kind(&Interner)) { | 845 | if let Some(TyKind::Array(parameters, _)) = |
846 | deref_chain.last().map(|ty| ty.value.kind(&Interner)) | ||
847 | { | ||
843 | let kinds = deref_chain.last().unwrap().binders.clone(); | 848 | let kinds = deref_chain.last().unwrap().binders.clone(); |
844 | let unsized_ty = TyKind::Slice(parameters.clone()).intern(&Interner); | 849 | let unsized_ty = TyKind::Slice(parameters.clone()).intern(&Interner); |
845 | deref_chain.push(Canonical { value: unsized_ty, binders: kinds }) | 850 | deref_chain.push(Canonical { value: unsized_ty, binders: kinds }) |