Rust-analyzer vscode, macro generated types not reflected in editor

Hey all,

I'm using sqlx's compile time verification, but noticing that my editor plugin thinks that some types are of type unknown, despite being concrete to the compiler. For instance, check out the {unknown} type on the comments variable:

.

The correct types are used by the compiler.

For instance,

println!("${:?}", comments.get(0).unwrap().id); // ok!
println!("${:?}", comments.get(0).unwrap().idZ); // error! no field `idZ` on type `&PostComment`

I tried setting DATABASE_URL (used by the macro) before launching VSCode and event setting:

  "rust-analyzer.server.extraEnv": {
    "DATABASE_URL": "sqlite://foobar.db"
  }

Any idea how to get the correct types to propagate through

Type check error in sqlx chain · Issue #6833 · rust-lang/rust-analyzer · GitHub seems related.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.