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 <lukastw97@gmail.com>
This commit is contained in:
commit
6f41053ede
@ -18,12 +18,11 @@ macro_rules! register_builtin {
|
||||
db: &dyn AstDatabase,
|
||||
id: MacroCallId,
|
||||
tt: &tt::Subtree,
|
||||
item: &tt::Subtree,
|
||||
) -> ExpandResult<tt::Subtree> {
|
||||
let expander = match *self {
|
||||
$( BuiltinAttrExpander::$variant => $expand, )*
|
||||
};
|
||||
expander(db, id, tt, item)
|
||||
expander(db, id, tt)
|
||||
}
|
||||
|
||||
fn find_by_name(name: &name::Name) -> Option<Self> {
|
||||
@ -63,8 +62,7 @@ pub fn find_builtin_attr(
|
||||
fn dummy_attr_expand(
|
||||
_db: &dyn AstDatabase,
|
||||
_id: MacroCallId,
|
||||
_tt: &tt::Subtree,
|
||||
item: &tt::Subtree,
|
||||
tt: &tt::Subtree,
|
||||
) -> ExpandResult<tt::Subtree> {
|
||||
ExpandResult::ok(item.clone())
|
||||
ExpandResult::ok(tt.clone())
|
||||
}
|
||||
|
@ -53,10 +53,7 @@ impl TokenExpander {
|
||||
TokenExpander::MacroRules { mac, .. } => mac.expand(tt),
|
||||
TokenExpander::MacroDef { mac, .. } => mac.expand(tt),
|
||||
TokenExpander::Builtin(it) => it.expand(db, id, tt),
|
||||
TokenExpander::BuiltinAttr(it) => match db.macro_arg(id) {
|
||||
Some(macro_arg) => it.expand(db, id, tt, ¯o_arg.0),
|
||||
None => mbe::ExpandResult::str_err("No item argument for attribute".to_string()),
|
||||
},
|
||||
TokenExpander::BuiltinAttr(it) => it.expand(db, id, tt),
|
||||
TokenExpander::BuiltinDerive(it) => it.expand(db, id, tt),
|
||||
TokenExpander::ProcMacro(_) => {
|
||||
// We store the result in salsa db to prevent non-deterministic behavior in
|
||||
|
Loading…
x
Reference in New Issue
Block a user