-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Autocomplete seems broken by a LazyLock
+ conditional crate paths
#18798
Comments
LazyLock
LazyLock
+ conditional crate paths
I'm trying to understand what's the role of the |
@mockersf @raldone01 may have better hypotheses than I do here about what's going on: bevyengine/bevy#16766 was the offending PR. |
I tried and I'm getting completions normally (Windows), both in 0.15.0 and in this commit. |
I can look into it in the new year. I will try to reproduce it on my machines. Seems very weird. Seems like RA keeps the proc macros instantiated across crates which rustc does not. |
Indeed it does, because r-a analyzes all crates at once while rustc compiles one crate at a time. In general proc macros should not rely on external state, and their behavior if they do is non-guaranteed, even in rustc. So if this is the problem I believe it's working as intended. |
rust-analyzer caches proc-macro expansions unlike rustc, it also doesn't unload the library unlike rustc. You generally cannot assume when and how often a proc-macro gets re-executed. The only thing you may assume is the environment (env vars, working directory) which is also not ideal but cargo is not going to change the working directory anymore now (the breakage would be too severe if they tried). |
Awesome, thanks for the help and feedback :) I'm happy to call this an "us problem"; I hope this thread helps some poor soul years down the line. |
* Fixed a bug where rust analyser would resolve the crate paths incorrectly due to caching of `'static` lifetimes. See [rust-analyzer#18798](rust-lang/rust-analyzer#18798) and [bevy#17004](bevyengine/bevy#17004).
* Fixed a bug where rust analyser would resolve the crate paths incorrectly due to caching of `'static` lifetimes. See [rust-analyzer#18798](rust-lang/rust-analyzer#18798) and [bevy#17004](bevyengine/bevy#17004).
rust-analyzer version: rust-analyzer 1.83.0 (90b35a6 2024-11-26)
rustc version: 1.83
editor or extension: VsCode
relevant settings: (eg. client settings, or environment variables like
CARGO
,RUSTC
,RUSTUP_HOME
orCARGO_HOME
)repository link (if public, optional): bevyengine/bevy@760d0a3, which is the commit that broke this.
code snippet to reproduce:
First detected in bevyengine/bevy#17004. We can probably work around this, but this seems to be an RA bug.
The text was updated successfully, but these errors were encountered: