rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.38k stars 1.62k forks source link

Failure to Infer Complicated Types #16296

Closed HTGAzureX1212 closed 3 months ago

HTGAzureX1212 commented 11 months ago

rust-analyzer version: 0.4.1797-standalone (f595e60b6 2024-01-06)

DATABASE_POOL declaration:

pub type PostgresPool = Pool<PostgresConnectionManager<NoTls>>;
pub type DatabasePoolFuture = impl Future<Output = PostgresPool>;
pub static DATABASE_POOL: AsyncLazy<PostgresPool, DatabasePoolFuture> = AsyncLazy::new(async {
    let hartex_pgsql_url = env::var("HARTEX_NIGHTLY_PGSQL_URL").unwrap();

    let manager = PostgresConnectionManager::new_from_stringlike(hartex_pgsql_url, NoTls).unwrap();

    Pool::builder().build(manager).await.unwrap()
});

Rust Analyzer behaviour: image

RustRover behaviour: image

ShoyuVanilla commented 3 months ago

I think that this issue happend in here, right? https://github.com/TeamHarTex/HarTex/blob/6794deb510fa9f96eb4d0c3b26b729a8f5326f40/rust-utilities/hartex-discord-utils/src/lib.rs#L61-L73

This is not happening in the current version of r-a somehow;

issue

but I think that the cause was type alias impl trait in L64;

pub type DatabasePoolFuture = impl Future<Output = PostgresPool>;

I guess the reason this has been fixed somehow is my ATPIT implementation in #16852 worked partly in some TAITs and I think that this issue can be marked as closed by implementing TAIT correctly.