-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Learn cfg
s enabled in build.rs
#14452
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
Comments
Unsure how we would get to the output there since we have cargo execute the build scripts which will in turn eat that. I guess we could check Actually, shouldn't we be doing this already? If I am not mistaken the cfg field of BuildScript is just this right? |
Yeah, that's what I thought as well. |
Out of curiosity, do the logs complain about cyclic dependencies? And does r-a also complain about Will look into this myself tomorrow otherwise |
Can you point me at a resource for how to get r-a logs? |
Yeah, I'm using emacs. |
On Emacs, there should be a |
I restarted
|
Then this could likely be caused by us not handling cyclic deps yet, that is known to cause some issues at least #14167 |
We're seeing a similar issue described at esp-rs/esp-template#58. We have a cfg enabled in build.rs, like wasmtime, and details of what we're seeing are detailed in the linked issue I am not seeing the cyclic deps error message that wasmtime seems to be emitting. Not trying to conflate these problems -- I can create another issue if maintainers think it is pragmatic. Also I can spend some time debugging this if I could get useful state I can dump. Very open to hack on RA to diagnose this, given some direction! |
Seeing the same issue without cyclic dependencies, possibly relevant that the package in question contains both |
Wasmtime enables
cfg(compiler)
when one of its compilers (Cranelift or, soon, Winch) is available and therefore JIT compilation is available. Thiscfg
is enabled inbuild.rs
when the cargo features for the underlying compilers are enabled. This is much easier and more future proof than writing outcfg(any(feature = "cranelift", feature = "winch"))
all over the place, which is why things are done this way.However,
rust-analyzer
does not treat code blocks guarded by#[cfg(compiler)]
as enabled, and fails to do autocomplete/jump-to-def/etc within these regions, even though changing thecfg
to the wordiercfg(any(...))
does work.It would be nice if
rust-analyzer
looked at thecfg
s defined bybuild.rs
and enabled them for the project.The text was updated successfully, but these errors were encountered: