Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/builtin_attr_macro.rs')
-rw-r--r--crates/hir-expand/src/builtin_attr_macro.rs21
1 files changed, 9 insertions, 12 deletions
diff --git a/crates/hir-expand/src/builtin_attr_macro.rs b/crates/hir-expand/src/builtin_attr_macro.rs
index 33ba6d37d5..55157abe67 100644
--- a/crates/hir-expand/src/builtin_attr_macro.rs
+++ b/crates/hir-expand/src/builtin_attr_macro.rs
@@ -1,6 +1,5 @@
//! Builtin attributes.
-use span::{FileId, MacroCallId, Span, SyntaxContextId, ROOT_ERASED_FILE_AST_ID};
-use syntax::{TextRange, TextSize};
+use span::{MacroCallId, Span};
use crate::{db::ExpandDatabase, name, tt, ExpandResult, MacroCallKind};
@@ -102,7 +101,12 @@ fn derive_attr_expand(
MacroCallKind::Attr { attr_args: Some(attr_args), .. } if loc.def.is_attribute_derive() => {
attr_args
}
- _ => return ExpandResult::ok(tt::Subtree::empty(tt::DelimSpan::DUMMY)),
+ _ => {
+ return ExpandResult::ok(tt::Subtree::empty(tt::DelimSpan {
+ open: loc.call_site,
+ close: loc.call_site,
+ }))
+ }
};
pseudo_derive_attr_expansion(tt, derives, loc.call_site)
}
@@ -110,20 +114,13 @@ fn derive_attr_expand(
pub fn pseudo_derive_attr_expansion(
tt: &tt::Subtree,
args: &tt::Subtree,
- call_site: SyntaxContextId,
+ call_site: Span,
) -> ExpandResult<tt::Subtree> {
let mk_leaf = |char| {
tt::TokenTree::Leaf(tt::Leaf::Punct(tt::Punct {
char,
spacing: tt::Spacing::Alone,
- span: Span {
- range: TextRange::empty(TextSize::new(0)),
- anchor: span::SpanAnchor {
- file_id: FileId::BOGUS,
- ast_id: ROOT_ERASED_FILE_AST_ID,
- },
- ctx: call_site,
- },
+ span: call_site,
}))
};