mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-24 20:34:19 +00:00
ProcMacroProcessExpander: support attribute macros
This commit is contained in:
parent
403ed489ff
commit
e42e6f9ab9
2 changed files with 11 additions and 21 deletions
|
@ -42,9 +42,17 @@ impl tt::TokenExpander for ProcMacroProcessExpander {
|
|||
fn expand(
|
||||
&self,
|
||||
subtree: &Subtree,
|
||||
_attr: Option<&Subtree>,
|
||||
attr: Option<&Subtree>,
|
||||
) -> Result<Subtree, tt::ExpansionError> {
|
||||
self.process.custom_derive(&self.dylib_path, subtree, &self.name)
|
||||
let task = ExpansionTask {
|
||||
macro_body: subtree.clone(),
|
||||
macro_name: self.name.to_string(),
|
||||
attributes: attr.cloned(),
|
||||
lib: self.dylib_path.to_path_buf(),
|
||||
};
|
||||
|
||||
let result: ExpansionResult = self.process.send_task(msg::Request::ExpansionMacro(task))?;
|
||||
Ok(result.expansion)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue