@@ -53,19 +53,16 @@ impl TokenExpander {
53
53
TokenExpander :: MacroRules { mac, .. } => mac. expand ( tt) ,
54
54
TokenExpander :: MacroDef { mac, .. } => mac. expand ( tt) ,
55
55
TokenExpander :: Builtin ( it) => it. expand ( db, id, tt) ,
56
- // FIXME switch these to ExpandResult as well
57
56
TokenExpander :: BuiltinAttr ( it) => match db. macro_arg ( id) {
58
- Some ( macro_arg) => it. expand ( db, id, tt, & macro_arg. 0 ) . into ( ) ,
59
- None => mbe:: ExpandResult :: only_err (
60
- mbe:: ExpandError :: Other ( "No item argument for attribute" . to_string ( ) ) . into ( ) ,
61
- ) ,
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 ( ) ) ,
62
59
} ,
63
60
TokenExpander :: BuiltinDerive ( it) => it. expand ( db, id, tt) ,
64
61
TokenExpander :: ProcMacro ( _) => {
65
62
// We store the result in salsa db to prevent non-deterministic behavior in
66
63
// some proc-macro implementation
67
64
// See #4315 for details
68
- db. expand_proc_macro ( id) . into ( )
65
+ db. expand_proc_macro ( id)
69
66
}
70
67
}
71
68
}
@@ -133,7 +130,7 @@ pub trait AstDatabase: SourceDatabase {
133
130
/// proc macros, since they are not deterministic in general, and
134
131
/// non-determinism breaks salsa in a very, very, very bad way. @edwin0cheng
135
132
/// heroically debugged this once!
136
- fn expand_proc_macro ( & self , call : MacroCallId ) -> Result < tt:: Subtree , mbe :: ExpandError > ;
133
+ fn expand_proc_macro ( & self , call : MacroCallId ) -> ExpandResult < tt:: Subtree > ;
137
134
/// Firewall query that returns the error from the `macro_expand` query.
138
135
fn macro_expand_error ( & self , macro_call : MacroCallId ) -> Option < ExpandError > ;
139
136
@@ -379,18 +376,11 @@ fn macro_expand_error(db: &dyn AstDatabase, macro_call: MacroCallId) -> Option<E
379
376
db. macro_expand ( macro_call) . err
380
377
}
381
378
382
- fn expand_proc_macro (
383
- db : & dyn AstDatabase ,
384
- id : MacroCallId ,
385
- ) -> Result < tt:: Subtree , mbe:: ExpandError > {
379
+ fn expand_proc_macro ( db : & dyn AstDatabase , id : MacroCallId ) -> ExpandResult < tt:: Subtree > {
386
380
let loc: MacroCallLoc = db. lookup_intern_macro ( id) ;
387
381
let macro_arg = match db. macro_arg ( id) {
388
382
Some ( it) => it,
389
- None => {
390
- return Err (
391
- tt:: ExpansionError :: Unknown ( "No arguments for proc-macro" . to_string ( ) ) . into ( )
392
- )
393
- }
383
+ None => return ExpandResult :: str_err ( "No arguments for proc-macro" . to_string ( ) ) ,
394
384
} ;
395
385
396
386
let expander = match loc. def . kind {
0 commit comments