-
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
loadOutDirsFromCheck / proc macro ergonomics #6448
Comments
Yeah, it's about time we think about this... I don't think there really is a nice end-game here, short of banning build.rs and moving all proc macros to wasm. Short-term, I think we should just bite the bullet and enable this by default: this would be better for new users, because new users typically don't have gigantic projects. And we have checkOnSave enabled by default as well (I think?), so not-enabling We do need to improve quality of implementation though, before we flip the switch. Firstly, we need to make loading asynchronous. We first should execute basic Secondly, we need to add better observability for Thirdly, we should expose this observability to users: make sure that errors are properly shown, add command to re-query |
I agree that we should enable them by default, like we do for all features. One thing that's missing is detecting a proc macro server that crashes and disabling the feature. This is useful when there's an ABI mismatch, like we had before. I'm not sure we can support multiple ABIs, though. |
I wonder... what is the behavior of
|
See also #6174, though I'm not sure why it's needed. |
Ok, so this is 1) but not 2). This means that we need to map rustc version to ABI version ourselves (basically, we need to remember the latest version of rustc we are compatible with, which is either |
If the version differs, rustc behaves the same as with any other crate, which is reporting an error. Rustc decodes the full crate metadata for proc macros, which is much more unstable than the ABI of just libproc_macro.
Maybe libproc_macro could export an ABI version just for use by rust-analyzer? This ABI version would then be incremented manually every time there is an ABI incompatible change to libproc_macro. |
Yeah, that would plausible, but that means some manual and hard to remember work in the compiler. This is the right solution theoretically, but, organizationally, I think it would be easier to maintain this ABI version on our side (by mapping from rustc version to ABI version). |
|
We should also take a look at #3155 before enabling build script support. |
@lnicola I think that issue is independent of |
Is there any reason not to enable My best idea so far is |
The big reason is security: running `build.rs` when you just "read" the
code opens you to attacks. I believe our strategy here would be 🤷,
but I opened
https://internals.rust-lang.org/t/running-build-rs-in-rust-analyzer/14154
to discuss. I've already started renaming settings yesterday, but
apparently lost the code :( I want local history back ;(
…On Wed, 3 Mar 2021 at 14:00, Florian Diebold ***@***.***> wrote:
Is there any reason not to enable loadOutDirsFromCheck right now already?
Also I think we should find a better name for the setting while we're at it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6448 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANB3M5R37JSXPVO6XJQDJ3TBYJGHANCNFSM4TIUZN3A>
.
|
Yeah, but we have |
We could maybe only enable it by default if |
Status: we now set |
Since proc-macro is enabled by default for now, maybe we close this one ? |
Does that imply that but on the other hand there is still some mention of it in the manual. I'm asking, because the godot-rust FAQ recommends to use |
I think we renamed it to |
rust-analyzer has enabled proc-macro by default for a while [1], so we no longer need to set it explicitly. The spurious warning (#445) no longer reproduces with rust-analyzer 2022-01-17. [1]: rust-lang/rust-analyzer#6448
I'm puzzled by this. The fix for my proc macro issues was as per #7497 which I implemented 10 minutes ago, but this thread suggests I should be having macros working properly now. Is this an interaction with CoC? I'm regularly updating rust-analyzer whenever prompted. |
Both settings should be on by default. Maybe CoC turns them off by default from the client side. |
We regularly get bug reports from people that are fixed by enabling
loadOutDirsFromCheck
or proc macros. I'm wondering what the "endgame" is here.I think there are two reasons why we can't just enable these settings by default:
cargo check
.But the current situation where things just silently don't work or we produce wrong diagnostics isn't really tenable, right? I think we should ideally try to detect the situations where things aren't working because a build script or proc macro wasn't run, and warn the user.
Also maybe there should long-term be a way to have cargo run build scripts and compile proc macros without doing a full check? (Edit: Ah, this is rust-lang/cargo#7178.)
Shorter-term, here are some ideas:
env!("OUT_DIR")
and produce a diagnostic and/or a popup warning that things may not work?#[path]
modules?Long-term, maybe we want a pop-up that says "your project requires build scripts and/or proc macros to be built correctly, do you want to run them?" and/or a whitelist?
The text was updated successfully, but these errors were encountered: