Skip to content

Commit 6f41053

Browse files
bors[bot]Veykril
andauthored
Merge #9965
9965: minor: Don't ask for the builtin attribute input twice r=Veykril a=Veykril `tt` and `item` here were the same, I misunderstood what the main input for attributes was in #9943 bors r+ Co-authored-by: Lukas Wirth <[email protected]>
2 parents 4aa2a44 + cee0267 commit 6f41053

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

crates/hir_expand/src/builtin_attr.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ macro_rules! register_builtin {
1818
db: &dyn AstDatabase,
1919
id: MacroCallId,
2020
tt: &tt::Subtree,
21-
item: &tt::Subtree,
2221
) -> ExpandResult<tt::Subtree> {
2322
let expander = match *self {
2423
$( BuiltinAttrExpander::$variant => $expand, )*
2524
};
26-
expander(db, id, tt, item)
25+
expander(db, id, tt)
2726
}
2827

2928
fn find_by_name(name: &name::Name) -> Option<Self> {
@@ -63,8 +62,7 @@ pub fn find_builtin_attr(
6362
fn dummy_attr_expand(
6463
_db: &dyn AstDatabase,
6564
_id: MacroCallId,
66-
_tt: &tt::Subtree,
67-
item: &tt::Subtree,
65+
tt: &tt::Subtree,
6866
) -> ExpandResult<tt::Subtree> {
69-
ExpandResult::ok(item.clone())
67+
ExpandResult::ok(tt.clone())
7068
}

crates/hir_expand/src/db.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@ impl TokenExpander {
5353
TokenExpander::MacroRules { mac, .. } => mac.expand(tt),
5454
TokenExpander::MacroDef { mac, .. } => mac.expand(tt),
5555
TokenExpander::Builtin(it) => it.expand(db, id, tt),
56-
TokenExpander::BuiltinAttr(it) => match db.macro_arg(id) {
57-
Some(macro_arg) => it.expand(db, id, tt, &macro_arg.0),
58-
None => mbe::ExpandResult::str_err("No item argument for attribute".to_string()),
59-
},
56+
TokenExpander::BuiltinAttr(it) => it.expand(db, id, tt),
6057
TokenExpander::BuiltinDerive(it) => it.expand(db, id, tt),
6158
TokenExpander::ProcMacro(_) => {
6259
// We store the result in salsa db to prevent non-deterministic behavior in

0 commit comments

Comments
 (0)