-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Failed to parse macro invocation" when using puffin (regression) #6811
Comments
Direct link to all the macros in |
Reproduction : macro_rules! profile_function {
() => {
let _a = if true {
Some(1)
} else {
None
};
};
}
fn main() {
profile_function!();
// ^^ failed to parse macro invocation
} |
The simplest form : macro_rules! profile_function {
() => {
let _a = 1;
};
}
fn main() {
profile_function!();
// ^^ failed to parse macro invocation
} It seem to be related to this line: And because it is a statement ( |
@flodiebold I just checked that FIXME was written by you but I forget what it was meant. Could you shed some light about it ? |
IIRC the problem is that during body expansion, we need to detect whether the macro call is in a statement position, and then let it expand to statements instead of an expression and handle that case. |
Basically here we are already in an expression context, so we can't just expand to statements: So I guess we'd actually need to add a special case here to see if this is a top-level macro call, so we can let it expand to statements. |
Puffin is a nice little instrumented profiling library by @emilk .
It used to work well with rust-analyzer, but doesn't anymore since 0.2.408 or a very nearby version.
Complete repro
cargo.toml:
main.rs
The offending macro looks like this:
which doesn't look all that complicated but does call other macros from the macro - related to #6788 ? (EDIT: no, doesn't seem to be)
The text was updated successfully, but these errors were encountered: