aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-04-01 18:46:43 +0100
committerJonas Schievink <[email protected]>2021-04-01 18:46:43 +0100
commitb00266b79f0e2c2a5e332b30f7e6aba83b5e6e5a (patch)
treec7e591ec8a1ec6b401a8a7ea00115120a4789db5 /crates/hir/src
parent25201b2dad7b4b0d41494e238ebf643ad7ad8cd6 (diff)
Global TypeRef/TraitRef interning
Diffstat (limited to 'crates/hir/src')
-rw-r--r--crates/hir/src/display.rs2
-rw-r--r--crates/hir/src/lib.rs8
2 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir/src/display.rs b/crates/hir/src/display.rs
index 97a78ca25..ab04c55bc 100644
--- a/crates/hir/src/display.rs
+++ b/crates/hir/src/display.rs
@@ -91,7 +91,7 @@ impl HirDisplay for Function {
91 let ret_type = if !qual.is_async { 91 let ret_type = if !qual.is_async {
92 &data.ret_type 92 &data.ret_type
93 } else { 93 } else {
94 match &data.ret_type { 94 match &*data.ret_type {
95 TypeRef::ImplTrait(bounds) => match &bounds[0] { 95 TypeRef::ImplTrait(bounds) => match &bounds[0] {
96 TypeBound::Path(path) => { 96 TypeBound::Path(path) => {
97 path.segments().iter().last().unwrap().args_and_bindings.unwrap().bindings 97 path.segments().iter().last().unwrap().args_and_bindings.unwrap().bindings
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index 97f162315..06fd6542d 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -957,7 +957,7 @@ impl SelfParam {
957 func_data 957 func_data
958 .params 958 .params
959 .first() 959 .first()
960 .map(|param| match *param { 960 .map(|param| match &**param {
961 TypeRef::Reference(.., mutability) => match mutability { 961 TypeRef::Reference(.., mutability) => match mutability {
962 hir_def::type_ref::Mutability::Shared => Access::Shared, 962 hir_def::type_ref::Mutability::Shared => Access::Shared,
963 hir_def::type_ref::Mutability::Mut => Access::Exclusive, 963 hir_def::type_ref::Mutability::Mut => Access::Exclusive,
@@ -1011,7 +1011,7 @@ impl Const {
1011 } 1011 }
1012 1012
1013 pub fn type_ref(self, db: &dyn HirDatabase) -> TypeRef { 1013 pub fn type_ref(self, db: &dyn HirDatabase) -> TypeRef {
1014 db.const_data(self.id).type_ref.clone() 1014 db.const_data(self.id).type_ref.as_ref().clone()
1015 } 1015 }
1016} 1016}
1017 1017
@@ -1101,7 +1101,7 @@ impl TypeAlias {
1101 } 1101 }
1102 1102
1103 pub fn type_ref(self, db: &dyn HirDatabase) -> Option<TypeRef> { 1103 pub fn type_ref(self, db: &dyn HirDatabase) -> Option<TypeRef> {
1104 db.type_alias_data(self.id).type_ref.clone() 1104 db.type_alias_data(self.id).type_ref.as_deref().cloned()
1105 } 1105 }
1106 1106
1107 pub fn ty(self, db: &dyn HirDatabase) -> Type { 1107 pub fn ty(self, db: &dyn HirDatabase) -> Type {
@@ -1615,7 +1615,7 @@ impl Impl {
1615 // FIXME: the return type is wrong. This should be a hir version of 1615 // FIXME: the return type is wrong. This should be a hir version of
1616 // `TraitRef` (ie, resolved `TypeRef`). 1616 // `TraitRef` (ie, resolved `TypeRef`).
1617 pub fn trait_(self, db: &dyn HirDatabase) -> Option<TraitRef> { 1617 pub fn trait_(self, db: &dyn HirDatabase) -> Option<TraitRef> {
1618 db.impl_data(self.id).target_trait.clone() 1618 db.impl_data(self.id).target_trait.as_deref().cloned()
1619 } 1619 }
1620 1620
1621 pub fn self_ty(self, db: &dyn HirDatabase) -> Type { 1621 pub fn self_ty(self, db: &dyn HirDatabase) -> Type {