rust-lang / rust-analyzer

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

Method in imported trait from md-5 not recognized #15813

Open ronnodas opened 11 months ago

ronnodas commented 11 months ago

The following code runs fine, but the chain_update and finalize methods seem to not be recognized by rust-analyzer.

use md5::{Digest as _, Md5}; // 0.10.6

fn main() {
    let hash = update_hasher(Md5::new().chain_update(b"xyz")).finalize();
    println!("{hash:x}");
}

fn update_hasher(hasher: Md5) -> Md5 {
    hasher.chain_update(b"abc")
}

It further results in "no method on type" errors (E0599) if experimental diagnostics are enabled, but somehow not on the chain_update in main.

rust-analyzer version: 0.3.1705-standalone

rustc version: rustc 1.73.0 (cc66ad468 2023-10-03)

relevant settings: "rust-analyzer.diagnostics.enable": true

Veykril commented 11 months ago

The crate relies on typenum so most likely hits some chalk limit