diff options
author | Jonas Schievink <[email protected]> | 2021-03-19 20:23:57 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-03-19 20:23:57 +0000 |
commit | 636de3c709a7c86a1d3a870dc5dc3566310e9d92 (patch) | |
tree | 79729a2efc6d2cdb2557cd313ee79a25245983d3 /crates/hir/src | |
parent | fc5f73de45478058aa6d61e328733224cfa16efa (diff) |
Add `AttrsWithOwner` and clean up `source_map`
Diffstat (limited to 'crates/hir/src')
-rw-r--r-- | crates/hir/src/attrs.rs | 8 | ||||
-rw-r--r-- | crates/hir/src/lib.rs | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir/src/attrs.rs b/crates/hir/src/attrs.rs index dab8da7bb..4a11622fc 100644 --- a/crates/hir/src/attrs.rs +++ b/crates/hir/src/attrs.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! Attributes & documentation for hir types. | 1 | //! Attributes & documentation for hir types. |
2 | use hir_def::{ | 2 | use hir_def::{ |
3 | attr::{Attrs, Documentation}, | 3 | attr::{AttrsWithOwner, Documentation}, |
4 | path::ModPath, | 4 | path::ModPath, |
5 | per_ns::PerNs, | 5 | per_ns::PerNs, |
6 | resolver::HasResolver, | 6 | resolver::HasResolver, |
@@ -16,7 +16,7 @@ use crate::{ | |||
16 | }; | 16 | }; |
17 | 17 | ||
18 | pub trait HasAttrs { | 18 | pub trait HasAttrs { |
19 | fn attrs(self, db: &dyn HirDatabase) -> Attrs; | 19 | fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner; |
20 | fn docs(self, db: &dyn HirDatabase) -> Option<Documentation>; | 20 | fn docs(self, db: &dyn HirDatabase) -> Option<Documentation>; |
21 | fn resolve_doc_path( | 21 | fn resolve_doc_path( |
22 | self, | 22 | self, |
@@ -36,7 +36,7 @@ pub enum Namespace { | |||
36 | macro_rules! impl_has_attrs { | 36 | macro_rules! impl_has_attrs { |
37 | ($(($def:ident, $def_id:ident),)*) => {$( | 37 | ($(($def:ident, $def_id:ident),)*) => {$( |
38 | impl HasAttrs for $def { | 38 | impl HasAttrs for $def { |
39 | fn attrs(self, db: &dyn HirDatabase) -> Attrs { | 39 | fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner { |
40 | let def = AttrDefId::$def_id(self.into()); | 40 | let def = AttrDefId::$def_id(self.into()); |
41 | db.attrs(def) | 41 | db.attrs(def) |
42 | } | 42 | } |
@@ -70,7 +70,7 @@ impl_has_attrs![ | |||
70 | macro_rules! impl_has_attrs_enum { | 70 | macro_rules! impl_has_attrs_enum { |
71 | ($($variant:ident),* for $enum:ident) => {$( | 71 | ($($variant:ident),* for $enum:ident) => {$( |
72 | impl HasAttrs for $variant { | 72 | impl HasAttrs for $variant { |
73 | fn attrs(self, db: &dyn HirDatabase) -> Attrs { | 73 | fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner { |
74 | $enum::$variant(self).attrs(db) | 74 | $enum::$variant(self).attrs(db) |
75 | } | 75 | } |
76 | fn docs(self, db: &dyn HirDatabase) -> Option<Documentation> { | 76 | fn docs(self, db: &dyn HirDatabase) -> Option<Documentation> { |
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 5ebd0a3b8..300087f1f 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -89,7 +89,7 @@ pub use crate::{ | |||
89 | pub use { | 89 | pub use { |
90 | hir_def::{ | 90 | hir_def::{ |
91 | adt::StructKind, | 91 | adt::StructKind, |
92 | attr::{Attr, Attrs, Documentation}, | 92 | attr::{Attr, Attrs, AttrsWithOwner, Documentation}, |
93 | body::scope::ExprScopes, | 93 | body::scope::ExprScopes, |
94 | find_path::PrefixKind, | 94 | find_path::PrefixKind, |
95 | import_map, | 95 | import_map, |