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

rust-analyzer gets confused on variable type when using the use_async yew hook. #11510

Open
teooliver opened this issue Feb 20, 2022 · 1 comment
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now

Comments

@teooliver
Copy link

teooliver commented Feb 20, 2022

rust-analyzer version: 02904e9 2022-02-14 stable
rustc version: rustc 1.58.1 (db9d1b20b 2022-01-20)

Rust-analyzer marks variable as &{unknown} type, but it actually kind of knows what type it really is as shown in the images.

I also created a minimal reproducible example here:
https://github.com/teooliver/rust-analyzer-bug-report

File in question:
https://github.com/teooliver/rust-analyzer-bug-report/blob/main/src/event_table.rs#L24-L38

The use_async hook function:
https://github.com/jetli/yew-hooks/blob/da43937a3460375e748d03da91b6d248ecd1900d/crates/yew-hooks/src/hooks/use_async.rs#L154-L168


Screen Shot 2022-02-20 at 8 47 12 PM

Screen Shot 2022-02-20 at 8 25 04 PM

Screen Shot 2022-02-20 at 8 25 46 PM

Screen Shot 2022-02-20 at 8 26 02 PM

Screen Shot 2022-02-20 at 7 30 53 PM


It works on Intellij Rust (0.4.165.4438-213):

Screen Shot 2022-02-20 at 8 36 06 PM

@teooliver teooliver changed the title rust-analyzer gets confused on variable type when using use_async yew hook. rust-analyzer gets confused on variable type when using the use_async yew hook. Feb 20, 2022
@flodiebold flodiebold added A-ty type system / type inference / traits / method resolution C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now labels Feb 21, 2022
@flodiebold
Copy link
Member

UseAsyncHandle implements Deref, and for some reason we can't solve that.

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 S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

2 participants