Gives error:
Syntax Error: expected SEMICOLON on the return in lib.rs.
rust-analyzer version: rust-analyzer version: 0.3.2862-standalone [/home/jacob/.vscode-oss/extensions/rust-lang.rust-analyzer-0.3.2862-linux-x64/server/rust-analyzer]
rustc version: rustc 1.93.0 (254b59607 2026-01-19)
editor or extension: VSCodium with rust-analyzer extension
relevant settings:
{
"rust-analyzer.imports.prefix": "crate",
"rust-analyzer.imports.merge.glob": false,
"rust-analyzer.cargo.features": "all",
"rust-analyzer.runnables.extraTestBinaryArgs": [
"--nocapture"
],
"rust-analyzer.checkOnSave": true,
}
code snippet to reproduce:
Rustc compiles it with no errors or warnings:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=a0e293172a696adb24d2255941a1ad52
my_macro:
const BODY: &str = r#"
pub fn f(v: S) -> bool {
return v.f();
}
"#;
use proc_macro::TokenStream;
#[proc_macro_attribute]
pub fn my_macro(_arg: TokenStream, _body: TokenStream) -> TokenStream {
BODY.parse().unwrap()
}
lib:
pub struct S;
impl S {
fn f(self) -> bool {
true
}
}
#[my_macro::my_macro]
pub fn f(v: S) -> bool {
return #[foo] v.f();
}
Gives error:
Syntax Error: expected SEMICOLONon thereturninlib.rs.rust-analyzer version: rust-analyzer version: 0.3.2862-standalone [/home/jacob/.vscode-oss/extensions/rust-lang.rust-analyzer-0.3.2862-linux-x64/server/rust-analyzer]
rustc version: rustc 1.93.0 (254b59607 2026-01-19)
editor or extension: VSCodium with rust-analyzer extension
relevant settings:
{ "rust-analyzer.imports.prefix": "crate", "rust-analyzer.imports.merge.glob": false, "rust-analyzer.cargo.features": "all", "rust-analyzer.runnables.extraTestBinaryArgs": [ "--nocapture" ], "rust-analyzer.checkOnSave": true, }code snippet to reproduce:
Rustc compiles it with no errors or warnings:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=a0e293172a696adb24d2255941a1ad52
my_macro:lib: