-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-macromacro expansionmacro expansionE-has-instructionsIssue has some instructions and pointers to code to get startedIssue has some instructions and pointers to code to get startedS-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right now
Description
Here's a simple version of the problem using the if_chain
macro:
#[macro_use] extern crate if_chain;
fn main() {
if_chain! {
then { let _ = drop(()); }
}
}
In rustc this works fine, but rust-analyzer marks the (())
as failed to parse macro invocation
. Note that if_chain!
is a macro_rules
macro, so this is an issue in macro expansion. The contents of the then { ... }
branch is matched using the matcher then { $($then:tt)* }
so even though this portion of the code is mostly untouched by the macro (it's supposed to expand to just let _ = drop(());
) it is matched as a list of token trees, of which (())
is one of them. The let _ =
is also part of the error, so it may be getting confused with the other matches in the macro.
lambda-fairy
Metadata
Metadata
Assignees
Labels
A-macromacro expansionmacro expansionE-has-instructionsIssue has some instructions and pointers to code to get startedIssue has some instructions and pointers to code to get startedS-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right now