okapi icon indicating copy to clipboard operation
okapi copied to clipboard

rocket_okapi macro breaks recent rust-analyzer ("expected Expr")

Open Youx opened this issue 4 months ago • 1 comments

When using recent versions of rust, okapi macros break rust-analyzer, with cryptic message "expected Expr".

Rustc compiles properly, so it is only visible when editing code

Simple example that reproduces:

use rocket::get;
use rocket_okapi::openapi;

#[openapi(tag = "Toto")]
#[get("/<x>")]
async fn test(x: u32) {
    println!("x: {x}");
    todo!()
}

fn main() {
    println!("Hello, world!");
}

I'm preparing a fix, I think it would be very nice to release a 0.9.1 with a backport of it 🙏

Youx avatar Aug 11 '25 16:08 Youx

Related ticket on rust-analyzer side :

https://github.com/rust-lang/rust-analyzer/issues/20153

Youx avatar Aug 11 '25 16:08 Youx