Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finding types of expressions yields "unknown" for generic types #4189

Closed
sdroege opened this issue Apr 28, 2020 · 4 comments
Closed

Finding types of expressions yields "unknown" for generic types #4189

sdroege opened this issue Apr 28, 2020 · 4 comments

Comments

@sdroege
Copy link

sdroege commented Apr 28, 2020

fn main() {
    let a = Some(3);
    let _b = a.and_then(|a1| a.map(|a2| a1 + a2));
    let c = std::sync::Mutex::new(2);
    let d = c.lock().unwrap();
    assert_eq!(*d, 2);
}

All variables are detected as "unknown" type here. This also has the side-effect that no autocomplete suggestions are provided (for example when typing a.and_ it gave nothing, or c.loc etc.).

Even when doing let c: std::sync::Mutex<i32> = ... the type of c is unknown (or the equivalent for a with Option<i32>.

@lnicola
Copy link
Member

lnicola commented Apr 28, 2020

Hmm..

image

@bjorn3
Copy link
Member

bjorn3 commented Apr 28, 2020

Is the rust-src rustup component installed?

$ rustup component list | grep rust-src
rust-src (installed)

@sdroege
Copy link
Author

sdroege commented Apr 28, 2020

Indeed, that was it. I'm sure I installed it before but apparently not (or not in this machine?). Sorry for the noise!

@sdroege sdroege closed this as completed Apr 28, 2020
@matklad
Copy link
Member

matklad commented Apr 28, 2020

Yet another thing which we can show in status... cc #4074

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants