rust-analyzer
rust-analyzer copied to clipboard
Failure to parse macro converting a `stmt` into a `block`
rust-analyzer version: rust-analyzer version: 5e8515870 2022-03-14 stable
rustc version: rustc 1.59.0 (9d1b2106e 2022-02-23)
relevant settings: don't think I have anything custom
More or less minimal example:
fn main() {
macro_rules! parse {
($action:block) => ($action);
($action:stmt) => (
parse!({ $action })
);
}
parse!(let _ = 1);
}
rust-analyzer errors with "expected Block", meanwhile rustc expands this fine into:
fn main() {
{
let _ = 1;
};
}
Adding ;
manually, i.e. parse!({ $action; })
, makes r-a parse/expand it correctly but produces an "unnecessary trailing semicolon" warning.
I can't reproduce it now. (3eb340fa4 2022-08-10)
Maybe it is fixed ?
reproduces for me on 5366009fe 2022-08-09
Oh , I forget to turn on the rust-analyzer.diagnostics.experimental.enable
.