diff options
Diffstat (limited to 'crates/hir_def/src/attr.rs')
-rw-r--r-- | crates/hir_def/src/attr.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs index 52a2bce9b..2bab121d9 100644 --- a/crates/hir_def/src/attr.rs +++ b/crates/hir_def/src/attr.rs | |||
@@ -18,6 +18,7 @@ use tt::Subtree; | |||
18 | 18 | ||
19 | use crate::{ | 19 | use crate::{ |
20 | db::DefDatabase, | 20 | db::DefDatabase, |
21 | intern::Interned, | ||
21 | item_tree::{ItemTreeId, ItemTreeNode}, | 22 | item_tree::{ItemTreeId, ItemTreeNode}, |
22 | nameres::ModuleSource, | 23 | nameres::ModuleSource, |
23 | path::{ModPath, PathKind}, | 24 | path::{ModPath, PathKind}, |
@@ -98,7 +99,7 @@ impl RawAttrs { | |||
98 | Either::Right(comment) => comment.doc_comment().map(|doc| Attr { | 99 | Either::Right(comment) => comment.doc_comment().map(|doc| Attr { |
99 | index: i as u32, | 100 | index: i as u32, |
100 | input: Some(AttrInput::Literal(SmolStr::new(doc))), | 101 | input: Some(AttrInput::Literal(SmolStr::new(doc))), |
101 | path: ModPath::from(hir_expand::name!(doc)), | 102 | path: Interned::new(ModPath::from(hir_expand::name!(doc))), |
102 | }), | 103 | }), |
103 | }) | 104 | }) |
104 | .collect::<Arc<_>>(); | 105 | .collect::<Arc<_>>(); |
@@ -510,7 +511,7 @@ impl AttrSourceMap { | |||
510 | #[derive(Debug, Clone, PartialEq, Eq)] | 511 | #[derive(Debug, Clone, PartialEq, Eq)] |
511 | pub struct Attr { | 512 | pub struct Attr { |
512 | index: u32, | 513 | index: u32, |
513 | pub(crate) path: ModPath, | 514 | pub(crate) path: Interned<ModPath>, |
514 | pub(crate) input: Option<AttrInput>, | 515 | pub(crate) input: Option<AttrInput>, |
515 | } | 516 | } |
516 | 517 | ||
@@ -524,7 +525,7 @@ pub enum AttrInput { | |||
524 | 525 | ||
525 | impl Attr { | 526 | impl Attr { |
526 | fn from_src(ast: ast::Attr, hygiene: &Hygiene, index: u32) -> Option<Attr> { | 527 | fn from_src(ast: ast::Attr, hygiene: &Hygiene, index: u32) -> Option<Attr> { |
527 | let path = ModPath::from_src(ast.path()?, hygiene)?; | 528 | let path = Interned::new(ModPath::from_src(ast.path()?, hygiene)?); |
528 | let input = if let Some(ast::Expr::Literal(lit)) = ast.expr() { | 529 | let input = if let Some(ast::Expr::Literal(lit)) = ast.expr() { |
529 | let value = match lit.kind() { | 530 | let value = match lit.kind() { |
530 | ast::LiteralKind::String(string) => string.value()?.into(), | 531 | ast::LiteralKind::String(string) => string.value()?.into(), |