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

Remove RUSTC_WRAPPER hack #12998

Closed
wants to merge 1 commit into from
Closed

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Aug 11, 2022

Closes #12973

@matklad
Copy link
Member

matklad commented Aug 11, 2022

It feels like a PR/commit which could include a fair amount of context in the body :P

Absolutely not every commit should have a great commit message, but this probably shold

@Veykril
Copy link
Member Author

Veykril commented Aug 11, 2022

Will add more context in a bit (doing some more timings testing right now)

@jplatte
Copy link
Contributor

jplatte commented Aug 11, 2022

So I've just disabled rust-analyzer.cargo.buildScripts.useRustcWrapper to work around the anyhow issues (which apparently are still there on 1.0.61?), and that makes even more build scripts fail, or at least that's what the popup says.

When I look at the language server output, it seems like it's complaining about the crate I'm working on right now, which of course isn't always in a buildable state, but this is a binary crate without a build.rs so I'm quite puzzled. In any case, just wanted to let this be known, I'll try to see whether this reproduces in other workspaces / what could be wrong here.

@lnicola
Copy link
Member

lnicola commented Aug 11, 2022

I've seen some weird build errors without the proxy which got fixed after a cargo clean, but you might be right.

@Veykril
Copy link
Member Author

Veykril commented Aug 11, 2022

Ye, so I tested this on a random crate I had lying around https://github.com/djeedai/bevy_hanabi, current master takes ~20s to fully load metadata with build script set ups. With this PR its ~30s. And as jplatte mentioned, the problem is if a crate in the workspace is not in a buildable state, we will pop up an error even if build scripts work fine...

So I guess we have to stick to the wrapper still until cargo gives us an alternative

@jplatte
Copy link
Contributor

jplatte commented Aug 11, 2022

Yeah, not using the rustc wrapper is a pretty bad experience right now. Just opened up another workspace with currently-non-buildable proc-macro code and the same error popped up, which I'm pretty sure was not the case before.

edit: No, actually this always happens when opening that workspace, regardless of the setting :(

@lnicola
Copy link
Member

lnicola commented Aug 11, 2022

@jplatte you should probably test on a nightly which includes #12984. That might help a little, but probably not as much as the wrapper.

@jplatte
Copy link
Contributor

jplatte commented Aug 11, 2022

Yeah I'm gonna use the wrapper again. It only breaks anyhow, and only on non-nightly versions.

@matklad
Copy link
Member

matklad commented Aug 11, 2022

current master takes ~20s to fully load metadata with build script set ups. With this PR its ~30s.

I'd say that 30% slowdown here is an acceptable cost to pay here to avoid questionable hacks.

For error reporting, I think we could add some filtering and just ignore errors from everything which is not compiled for $host?

@lnicola
Copy link
Member

lnicola commented Aug 11, 2022

It not always 30%, if you disable check on save, it can take arbitrarily longer depending on how large the project is, right?

@matklad
Copy link
Member

matklad commented Aug 11, 2022

It not always 30%, if you disable check on save, it can take arbitrarily longer depending on how large the project is, right?

Right: I think 2x slowdown would be OK, 10x would be too much. For a typical project, I would probably expect something closer to 2x.

And in theory rust-analyzer should work OK while proc-macros are not loaded, it's not like you are completely blocked.

🤔 I wonder, can we maybe detect, by reading cargo messages, when all proc-macros have already compiled and kill the cargo thence? Probably not.

@flodiebold
Copy link
Member

We could just disable it by default, instead of immediately removing it?

@lnicola
Copy link
Member

lnicola commented Aug 11, 2022

We could, but the only crate which doesn't build correctly under the wrapper happens to be quite popular, so most users would have to keep it disabled.

@Veykril
Copy link
Member Author

Veykril commented Aug 11, 2022

It not always 30%, if you disable check on save, it can take arbitrarily longer depending on how large the project is, right?

Note I tested this with checkOnSave disabled on a project that had no build artifacts yet, but yes the slowdown will scale with project size, though bevy as a dependency is already pretty large i think.

@veber-alex
Copy link
Contributor

which apparently are still there on 1.0.61?

I can't reproduce the issue with anyhow 1.0.61 on either stable or nightly.

@Veykril Veykril marked this pull request as draft August 13, 2022 08:57
@bors
Copy link
Contributor

bors commented Aug 13, 2022

☔ The latest upstream changes (presumably #13010) made this pull request unmergeable. Please resolve the merge conflicts.

@lnicola lnicola mentioned this pull request Oct 10, 2022
@Veykril Veykril added the S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work. label Nov 3, 2022
@lnicola
Copy link
Member

lnicola commented Jan 10, 2023

I think this hasn't been a problem lately, and ideally we'll get a caego option (not that there's been much interest on the cargo side). So it makes sense to close this.

@Veykril
Copy link
Member Author

Veykril commented Jan 10, 2023

Ye let's close this, so far no one of the cargo team has replied to the RFC unfortunately so thsi will probably be a while until we can remove this.

@Veykril Veykril closed this Jan 10, 2023
@Veykril Veykril deleted the rustc-wrapper branch August 21, 2024 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The no-op always-success RUSTC_WRAPPER breaks build scripts
7 participants