-
Notifications
You must be signed in to change notification settings - Fork 1.8k
"Failed to parse macro invocation" when using crate "proconio" #8171
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
Comments
Some additional information: As for released versions of Rust Analyzer, version 2021-03-22 and 2021-03-15 both show the error for the repro code, but if fn main() {
input! {
n: isize,
}
let _x = n;
} As for versions of Visual Studio Code extension, I can confirm the same behavior with rust-analyzer 0.2.529 and 0.2.521. 0.2.529 behaves like 2021-03-22, 0.2.521 behaves like 2021-03-15. I'm not sure they are exactly the same version - I don't know how to check it. The last one shows 0.2.521 can successfully parse the macro invocation ( |
Thanks for the report, It seem like there's still have some bugs related to statements after #8044. I am investigating on it right now, but need sometimes. A no-deps version of reproducible example : macro_rules! input {
// terminator
(@from [$source:expr] @rest) => {};
// parse mutability
(@from [$source:expr] @rest mut $($rest:tt)*) => {
input! {
@from [$source]
@mut [mut]
@rest $($rest)*
}
};
(@from [$source:expr] @rest $($rest:tt)*) => {
input! {
@from [$source]
@mut []
@rest $($rest)*
}
};
// parse variable pattern
(@from [$source:expr] @mut [$($mut:tt)?] @rest $var:tt: $($rest:tt)*) => {
input! {
@from [$source]
@mut [$($mut)*]
@var $var
@kind []
@rest $($rest)*
}
};
// parse kind (type)
(@from [$source:expr] @mut [$($mut:tt)?] @var $var:tt @kind [$($kind:tt)*] @rest) => {
let $($mut)* $var = 0;
};
(@from [$source:expr] @mut [$($mut:tt)?] @var $var:tt @kind [$($kind:tt)*] @rest, $($rest:tt)*) => {
input!(@from [$source] @mut [$($mut)*] @var $var @kind [$($kind)*] @rest);
};
(@from [$source:expr] @mut [$($mut:tt)?] @var $var:tt @kind [$($kind:tt)*] @rest $tt:tt $($rest:tt)*) => {
input!(@from [$source] @mut [$($mut)*] @var $var @kind [$($kind)* $tt] @rest $($rest)*);
};
($($rest:tt)*) => {
let mut _locked_stdin = "";
input! {
@from [&mut *locked_stdin]
@rest $($rest)*
}
drop(_locked_stdin); // release the lock
};
}
fn main() {
input! {
n: isize,
}
let a = n;
} |
|
Uh oh!
There was an error while loading. Please reload this page.
proconio is easy IO library for competitive programming.
Error occur when using
input!
macro.I can compile and run it, but I get "Failed to parse macro invocation" in rust-analyzer.
This error was confirmed in both vim and vscode.
rust-analyzer is nightly version(0.3.528).
Complete repro
cargo.toml:
main.rs
Thank you.
The text was updated successfully, but these errors were encountered: