-
Notifications
You must be signed in to change notification settings - Fork 224
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
Allow release version of Rust Analyzer to work on the code #64
Comments
For things like Starlark we have converged on a stable version of the toolchain. Looking at the features we still use, none immediately look like being painful to use. Perhaps the hardest one is the That said, on a completely fresh Windows computer, I just installed VS Code, Rust, Rust Analyzer, checked out Buck2, started it all up and Rust Analyzer worked for me perfectly at the root of the computer. I didn't configure anything. Go to definition works. Hover docs work. Errors show up when I hit save. What isn't working? |
Summary: This PR adds a basic fuzz test for the starlark parser and executor. The fuzzer has found a couple of non-critical bugs already :) so hopefully it'll be of some use to you :) X-link: facebook/starlark-rust#64 Reviewed By: stepancheg Differential Revision: D43697975 Pulled By: ndmitchell fbshipit-source-id: f8274390e804bafc4003d7018930ede14a506dd4
Picking a an arbitrary try block to try and understand why they are in use:
This doesn't seem like a particularly strong reason for indexmap - and indeed the TODO there gets to the essence of it. You could do something like
Which is shorter, clearer (because the error handling is in one place rather than spread out), and doesn't depend on an unstable feature with unclear future. I haven't checked godbolt but my intuition says it will generate quite similar code to the original, if efficiency is a concern (and if it is, may I suggest using I'd be happy to put a PR up removing any similarly easy transformations if that would be welcome. |
I think the advantage of removing some try blocks is relatively little, whereas removing them all and prohibiting new ones has some value - but it's questionable whether this is worth it. I think there are two points in the transformation that add value:
|
I think there is merit in treating aiming for stable-rust as a feature, and only using unstable features that are truely blocking for the ability to create buck2 effectively. I do agree that features that are well on the path to stablilisation are quite low risk, but adding in other things just because they are there seems like an unneeded source of churn and risk. For instance, |
While In practice over the lifetime of Buck2 there has been more churn over the Debug instance of String (which is considered stable but allowed to vary between releases) than any of the features... Agreed that being purely on stable would have value. But advantages like bisection aren't that useful if you are almost on stable. Btw, I just audited our features, and found 14 declarations weren't used at all, so I've deleted them (patch will be sync'd after it is approved, probably tomorrow). It might be worth figuring out which features we use are merely functions that are stabilising (e.g. |
This is not the case, there’s no preference for any particular version in rust-analyzer. By default, we run In terms of support for specific features, stable language features are supported, while unstable are best effort. I’d imagine it would be “good enough” in practice. One place where compiler version matters is proc macros. Rust analyzer consumes the same .so dynamic libraries with compiled proc macros as rustc. The ABI of these .so is not stable and tied to compiler versions. Rust-analyzer tries to support a range of ABI, but that’s not a particularly long range. However, if you use the nightly corresponding to the latest stable, it has the same ABI as stable, and this is a non-problem. To sum up, any observable issues with rust-analyzer support are unlikely to be attributed to the usage of nightly. rust-analyzer doesn’t tip the “recent nightly/recent stable” scale either way. |
Yeah, @matklad's response is correct here, but of course, he would know! I'm not in a position to dictate what the Buck team should do here with regard to unstable features, despite my personal stance being (perhaps unfairly!) negative towards them. Anyways, most features in rust-analyzer can/do work on Buck2 for the following reasons:
I think this issue can be closed in favor of a more specific "how many unstable features should buck2 use". |
It's not currently possible to use Rust Analyzer at the root of the repo. This holds back open-source collaboration.
This is because Rust Analzyer requires builds to build with one version of the toolchain, and by default, that's the stable version. This repo isn't built with the stable toolchain.
It's possible via Settings to get the Analyzer to use a particular nightly toolchain version, but even that is not sufficient, as there are crates used that themselves specify a different nightly toolchain version to the main toolchain being used.
Suggested fix: converge the code on the stable version of the toolchain, or, failing that, on a particular nightly version, so that Rust Analyzer can work.
The text was updated successfully, but these errors were encountered: