diff options
| author | bors <bors@rust-lang.org> | 2024-06-09 19:35:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-06-09 19:35:14 +0000 |
| commit | 5a1df7f548b28e64e898c3f1e8fc04cd15433233 (patch) | |
| tree | cf6b71327808e1d35bea732659edd63266b6d8c9 /src/tools | |
| parent | 994a9b86fff438534472a57c09b5194432fd7593 (diff) | |
| parent | a65c912663e917158b944630e3adce4eb132bf15 (diff) | |
Auto merge of #17375 - Veykril:attr-input-no-intern, r=Veykril
Don't intern attribute inputs as their spans make them unique
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/rust-analyzer/crates/hir-expand/src/attrs.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/attrs.rs b/src/tools/rust-analyzer/crates/hir-expand/src/attrs.rs index 85ec02ae073..db0feb055e1 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/attrs.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/attrs.rs @@ -54,7 +54,7 @@ impl RawAttrs { let span = span_map.span_for_range(comment.syntax().text_range()); Attr { id, - input: Some(Interned::new(AttrInput::Literal(tt::Literal { + input: Some(Box::new(AttrInput::Literal(tt::Literal { text: SmolStr::new(format_smolstr!("\"{}\"", Self::escape_chars(doc))), span, }))), @@ -199,7 +199,7 @@ impl AttrId { pub struct Attr { pub id: AttrId, pub path: Interned<ModPath>, - pub input: Option<Interned<AttrInput>>, + pub input: Option<Box<AttrInput>>, pub ctxt: SyntaxContextId, } @@ -234,7 +234,7 @@ impl Attr { })?); let span = span_map.span_for_range(range); let input = if let Some(ast::Expr::Literal(lit)) = ast.expr() { - Some(Interned::new(AttrInput::Literal(tt::Literal { + Some(Box::new(AttrInput::Literal(tt::Literal { text: lit.token().text().into(), span, }))) @@ -245,7 +245,7 @@ impl Attr { span, DocCommentDesugarMode::ProcMacro, ); - Some(Interned::new(AttrInput::TokenTree(Box::new(tree)))) + Some(Box::new(AttrInput::TokenTree(Box::new(tree)))) } else { None }; @@ -281,12 +281,12 @@ impl Attr { let input = match input.first() { Some(tt::TokenTree::Subtree(tree)) => { - Some(Interned::new(AttrInput::TokenTree(Box::new(tree.clone())))) + Some(Box::new(AttrInput::TokenTree(Box::new(tree.clone())))) } Some(tt::TokenTree::Leaf(tt::Leaf::Punct(tt::Punct { char: '=', .. }))) => { let input = match input.get(1) { Some(tt::TokenTree::Leaf(tt::Leaf::Literal(lit))) => { - Some(Interned::new(AttrInput::Literal(lit.clone()))) + Some(Box::new(AttrInput::Literal(lit.clone()))) } _ => None, }; |
