Closed
Description
Rust nightly accepts this code, but rust-analyzer is confused by the combination of a procedural macro (futures_async_stream::try_stream) and an anyhow macro:
[package]
name = "ra-proc-macro-type-issue"
version = "0.1.0"
edition = "2021"
[dependencies]
anyhow = "1.0"
futures = "0.3"
futures-async-stream = "0.2"
#![feature(
generators,
proc_macro_hygiene,
stmt_expr_attributes,
)]
use anyhow::{Error, bail};
use futures::stream::BoxStream;
use futures_async_stream::try_stream;
fn minimized_try_stream() -> BoxStream<'static, Result<String, Error>> {
Box::pin(
#[try_stream]
async move {
if false {
bail!("bye");
}
}
)
}
fn main() {
let _ = minimized_try_stream();
}
(if true
does the same.)
(also available at https://github.com/ludios/ra-proc-macro-type-issue)
expected Result<{unknown}, Error>, found () rust-analyzer(type-mismatch)
rust-analyzer version: 1f709d5 2022-05-05 nightly
rustc version: rustc 1.62.0-nightly (30f386087 2022-05-05)
relevant settings: (eg. client settings, or environment variables like CARGO
, RUSTUP_HOME
or CARGO_HOME
)