rust-lang / rust-lang/rust-analyzer
"Inline macro" doesn't work inside proc_macro_attribute
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
If I have normal function, I could expand macros like println inside it
fn test1() {
println!("hello"); // I could do "inline macro" here
}
But I couldn't if the function under proc_macro_attribute like async_trait
#[async_trait]
impl A for S {
fn test2() {
println!("hello"); // I couldn't do "inline macro" here
}
}
I know in some cases the outer proc_macro_attribute would change the AST inside it while I think in many cases it just keeps the inner TokenStream
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two examples in the issue: an inline println! in a normal function and inside an impl using #[async_trait]. Trace how rust-analyzer handles the proc_macro_attribute and its inner TokenStream, then verify that inline macros work in the attributed case without breaking cases where the attribute changes the AST.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100