Skip to content

RA doesn't infer types for several methods in a project #12738

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

Closed
64kramsystem opened this issue Jul 10, 2022 · 5 comments
Closed

RA doesn't infer types for several methods in a project #12738

64kramsystem opened this issue Jul 10, 2022 · 5 comments
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug

Comments

@64kramsystem
Copy link

64kramsystem commented Jul 10, 2022

rust-analyzer version: 0.0.0 (5342f47f4 2022-07-09)
rustc version: rustc 1.63.0-nightly (fdca237d5 2022-06-24)
relevant settings: nothing relevant

Hello!

RA doesn't infer types for several methods in a project, in at least one file. This is a Bevy project, so you may be aware of its typical problems 🙄 😬

The project/file is: https://github.com/64kramsystem/punchy-dev/blob/limit_players_distance/src/movement.rs.

Here's a screenshot:

image

@flodiebold flodiebold added A-ty type system / type inference / traits / method resolution C-bug Category: bug labels Jul 11, 2022
@mattfj10

This comment was marked as off-topic.

@lnicola

This comment was marked as off-topic.

@lnicola

This comment was marked as off-topic.

@64kramsystem
Copy link
Author

I have the exact same issue as you. out of nowhere rust-analyzer recently just started freaking out, it shows the version as "0.0.0" much like you (which I doubt is correct) and is suddenly unable to infer several types or gets types outright wrong. I've also seen a few other issues about this opened, so I wonder if this is just straight up a RA wide bug and not just the result of something in my environment or vscode being busted.

I've reinstalled RA, and switched to the release version (I was inadvertly using the prerelease), and removed all the related VSC files I cound find (essentially, ~/.config/Code/*analyzer*), and the 0.0.0 version is still there; not sure if it's related to the problem or not. The missed types still display.

(now going to address the other comments)

@64kramsystem
Copy link
Author

@64kramsystem are you using proc macros? They don't work on that nightly (#12600).

Hi there! Thanks for your help 😄 This is indeed a problem of using nightly Rust.

The problem happens with the nightly version above, and the current one (rustc 1.64.0-nightly (38b72154d 2022-07-11)).

I've switched to stable, and this fixed the problem, so I'm clsoing this (also because, it seems to be a duplicate).

Just for reference, the project does make use of procedural macros, although I'm not sure how they're directly related to the issue (but I don't doubt they are).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

4 participants