From 636de3c709a7c86a1d3a870dc5dc3566310e9d92 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 19 Mar 2021 21:23:57 +0100 Subject: Add `AttrsWithOwner` and clean up `source_map` --- crates/hir/src/attrs.rs | 8 ++++---- crates/hir/src/lib.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/hir') 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 @@ //! Attributes & documentation for hir types. use hir_def::{ - attr::{Attrs, Documentation}, + attr::{AttrsWithOwner, Documentation}, path::ModPath, per_ns::PerNs, resolver::HasResolver, @@ -16,7 +16,7 @@ use crate::{ }; pub trait HasAttrs { - fn attrs(self, db: &dyn HirDatabase) -> Attrs; + fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner; fn docs(self, db: &dyn HirDatabase) -> Option; fn resolve_doc_path( self, @@ -36,7 +36,7 @@ pub enum Namespace { macro_rules! impl_has_attrs { ($(($def:ident, $def_id:ident),)*) => {$( impl HasAttrs for $def { - fn attrs(self, db: &dyn HirDatabase) -> Attrs { + fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner { let def = AttrDefId::$def_id(self.into()); db.attrs(def) } @@ -70,7 +70,7 @@ impl_has_attrs![ macro_rules! impl_has_attrs_enum { ($($variant:ident),* for $enum:ident) => {$( impl HasAttrs for $variant { - fn attrs(self, db: &dyn HirDatabase) -> Attrs { + fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner { $enum::$variant(self).attrs(db) } fn docs(self, db: &dyn HirDatabase) -> Option { 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::{ pub use { hir_def::{ adt::StructKind, - attr::{Attr, Attrs, Documentation}, + attr::{Attr, Attrs, AttrsWithOwner, Documentation}, body::scope::ExprScopes, find_path::PrefixKind, import_map, -- cgit v1.2.3