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 no type inference timezones #15

Closed
Zercerium opened this issue Jul 24, 2023 · 6 comments
Closed

rust-analyzer no type inference timezones #15

Zercerium opened this issue Jul 24, 2023 · 6 comments

Comments

@Zercerium
Copy link

Hi,

is it expected that there is no type inference happening?
For example if I use let berlin = timezones::db::europe::BERLIN; it shows &{unknown} and also everything behind db:: is not recognised.
I'm on Mac and tried the current and the pre-release version of rust-analyzer with rust 1.71.
I didn't changed the rust-analyzer settings (rust-analyzer.cargo.buildScripts.enable is true, like default).
Builds works fine.
Any Suggestion what I could try out?

@Yuri6037
Copy link
Owner

Hi, I've just checked and I have the same issue. Interesting note is that it works under CLion. This appears to be a bug in rust analyzer.

@Zercerium
Copy link
Author

Ok it seems that the generated timezones.rs file ist just to big and rust-analyzer gives up.
If I reduce the entries in tzfiles and don't generate the static WIN_TIMEZONES everything works as expected. (Sometimes you have to restart rust-analyzer after the changes to pick up again)

@Yuri6037
Copy link
Owner

if it's only a file size problem I could try to divide up the generator in multiple files.

@Zercerium
Copy link
Author

I'm not sure what exactly triggers (file size, symbols in file, ...) the problem and couldn't find a similar issue with a first search.

a novice try with generating the file multiple times with different names and included these files under different mods, got some errors due to the different mods now, worked. (autocompletion and type inference)

the possibility to Limiting the Timezone Table to Zones of Interest like chrono_tz could also help, even if most of unused things should be stripped away at the build process? (probably another issue)

@Yuri6037
Copy link
Owner

There is apparently a token limit but the error does not show up under macOS systems: rust-lang/rust-analyzer#15335

@Zercerium
Copy link
Author

fixed upstream in rust-analyzer thanks to rust-lang/rust-analyzer#15819

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

2 participants