aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/item_tree/lower.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/item_tree/lower.rs')
-rw-r--r--crates/hir_def/src/item_tree/lower.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs
index 63b2826f8..f7ce2e26d 100644
--- a/crates/hir_def/src/item_tree/lower.rs
+++ b/crates/hir_def/src/item_tree/lower.rs
@@ -13,6 +13,7 @@ use syntax::{
13use crate::{ 13use crate::{
14 attr::Attrs, 14 attr::Attrs,
15 generics::{GenericParams, TypeParamData, TypeParamProvenance}, 15 generics::{GenericParams, TypeParamData, TypeParamProvenance},
16 type_ref::LifetimeRef,
16}; 17};
17 18
18use super::*; 19use super::*;
@@ -292,12 +293,16 @@ impl Ctx {
292 let self_type = TypeRef::Path(name![Self].into()); 293 let self_type = TypeRef::Path(name![Self].into());
293 match self_param.kind() { 294 match self_param.kind() {
294 ast::SelfParamKind::Owned => self_type, 295 ast::SelfParamKind::Owned => self_type,
295 ast::SelfParamKind::Ref => { 296 ast::SelfParamKind::Ref => TypeRef::Reference(
296 TypeRef::Reference(Box::new(self_type), Mutability::Shared) 297 Box::new(self_type),
297 } 298 self_param.lifetime_token().map(LifetimeRef::from_token),
298 ast::SelfParamKind::MutRef => { 299 Mutability::Shared,
299 TypeRef::Reference(Box::new(self_type), Mutability::Mut) 300 ),
300 } 301 ast::SelfParamKind::MutRef => TypeRef::Reference(
302 Box::new(self_type),
303 self_param.lifetime_token().map(LifetimeRef::from_token),
304 Mutability::Mut,
305 ),
301 } 306 }
302 } 307 }
303 }; 308 };
@@ -629,8 +634,7 @@ impl Ctx {
629 // add super traits as bounds on Self 634 // add super traits as bounds on Self
630 // i.e., trait Foo: Bar is equivalent to trait Foo where Self: Bar 635 // i.e., trait Foo: Bar is equivalent to trait Foo where Self: Bar
631 let self_param = TypeRef::Path(name![Self].into()); 636 let self_param = TypeRef::Path(name![Self].into());
632 generics.fill_bounds(&self.body_ctx, trait_def, self_param); 637 generics.fill_bounds(&self.body_ctx, trait_def, Either::Left(self_param));
633
634 generics.fill(&self.body_ctx, &mut sm, node); 638 generics.fill(&self.body_ctx, &mut sm, node);
635 } 639 }
636 GenericsOwner::Impl => { 640 GenericsOwner::Impl => {