-
Notifications
You must be signed in to change notification settings - Fork 9
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
Stability tracking - Clippy #18
Comments
What are the preconditions for the nursery move? |
None. We can do it asap. |
Can we do an intermediate step and move clippy to the rust repository, but keep publishing it in the current manner? There have been complaints and a lot of "me too" github votes on nightly breakage that isn't fixed within a day or two. |
Note that the "move clippy to the rust repo" plan is probably going to be via submoduling (perhaps submoduling a fork/branch to make it easier to do in-place fixes without waiting for clippy review). So the repo stays here, but it also goes in tree and gets CId. I'm open to doing that step now (adding a submodule and possibly setting up CI, but no distribution). Is there anything we should be worried about before this? I think the logical progression here would be:
|
I edited the OP to reflect these steps.
I should probably move our tests back to ui tests so they integrate better with rustc's test suite. |
I think this should be ok to do, I'll need to check with some of the core team
We're probably going to need to do these in the opposite order since once you're in the CI, you block PRs landing which mean all issues with the updating procedure, etc. need to be worked out.
Although we did this for the RLS, there is a strong feeling that we shouldn't do this for Rustfmt and Clippy. That is, once it hits the distro, it should be ready to ride the trains. We can use a
I think tests would be run separately from the compiler's (this is what we do with Cargo and RLS), so I don't think this is necessary (can still do it if you want, of course). |
is there a tracking issue for that or some other central place where the issues are discussed? |
Not really sorry. There's been a lot of ad hoc discussion on this topic - some on i.r-l.o and some in meetings, etc. Some issues are tracked here: #15 This doc discusses some things: https://github.com/nrc/dev-tools-team/blob/master/stability/README.md And there are some 'unknown unknowns' that we'll discover as we push on the RLS distribution |
I don't agree. The distro issues are a completely different set of issues from the CI issues, and tying them together seems like an unnecessary delay. (To be clear, when I said "distro issues", I was talking about the whole deal of "do we choose to have partial nightlies?", "how does this interact with the dist build", "how does I would like to add to CI early perhaps with the option for PR authors to turn it off to get stuff landed, as we work out the details of the process. IMO this will at least give us an early warning system, and by encouraging rustc devs to fix it on the clippy side too we can gauge how easy the process is and work towards improving it, all the while having an escape hatch for rustc devs when the process gets too hard. In general having a submodule which PR authors are allowed to redirect temporarily to a fork or a branch is a pretty smooth process, with a bit of burden on clippy devs to resync to master afterwards (which is fine). I don't really think this must be figured out for RLS and rustfmt first either, especially because it seems like these discussions for rustfmt and RLS haven't really gotten anywhere yet -- I'm willing to coordinate/push whatever decision making is necessary for clippy to move forward here.
I don't really see a reason to do this, but I see a major reason to not. Specifically, cargo-clippy does really weird things now so that It would also make life much easier for clippy users without requiring us to fix all the problems (which we can continue to work on incrementally); since then it won't break every two nightlies. |
I'm not talking about the distro issues, I'm talking about issues (both technical and political) of having tools CI blocking Rust PRs. There has been a lot of discussion and a lot of ideas floated, and in that situation we need to get actual experience with the processes before over-committing.
sure, but this needs to be implemented, documented, and communicated to other teams.
This is what we do with the RLS, but it is a bit more complicated than this. One constraint is that we don't want to point a submodule at a branch that might disappear, which rules out branches on individual's repos. That means one of the RLS/Clippy maintainers has to push the branch to upstream (and make sure it never gets deleted). This has proven to be enough of a speed bump that nobody has done this except me (a couple of times we've merged PRs to the RLS or Rustfmt that can solve a problem backwards compatibly).
This is not correct - the RLS is in tree and part of the CLI and we're getting useful information from working with it.
This is an implementation issue - we simply don't have anything in the infrastructure to have something part of nightly and not ride the trains. For the RLS, it has been manually removed with every release, but that is not something that can be generalised (in fact people are pretty unhappy about doing it for the RLS). Core team feeling when we discussed tool stability was that there was little benefit from the nightly-only situation. However, it sounds like for Clippy specifically it might be useful to ease implementation - if we landed at the start of a cycle, would 6 weeks be enough time to do that implementation? |
I meant that I was 😄 . The "figure out CI plan" was a part of "add to CI" (not "Wait for RLS/rustfmt distro issues to be worked out"), I didn't explicitly mention it, my bad.
I'd have a separate repo/fork on rust-lang which all rust reviewers have push for, and clippy/devtools devs keep the two in sync. Also, submodules pin to commits, not branches, and IIRC github doesn't delete commits after the first few minutes of their existence. We'd have to check this. Even then, all that is sufficient to make this work is to merge submodule contributions via
Fair; I wasn't aware of this.
maaaybe. I guess a simple hack is to continue to have cargo-clippy (which so far we're keeping out of distro; though I'm open to this changing) enforce nightly. The current version has nightly-only code by necessity, and it will continue to do so during most of the process of refactoring implementation. Once most of that is torn out we can move to a stable-compat The nice thing is that this process is something totally compatible with the "maaaybe" I gave you -- we can try to clean things up in 6 weeks. If done in time we remove the feature flag; if not, not much harm done, we build a useless dylib on a couple platforms that can be fetched via rustup but does nothing once fetched. |
New issue: @eddyb mentions that it is desirable to get rid of all plugins. Since clippy is currently a plugin, I see two ways forward:
I don't see an issue with 1. since clippy will be part of the distribution anyhow |
IMO custom drivers are the way forward, and the API should change to be more ergonomic. |
That sounds ok to me if the API is becoming more ergonomic. I think as a first step keeping it a regular plugin would help make transitioning easy. |
+1 for custom drivers. More ergonomics there would of course be great. I'm not really sure what Clippy's needs are, but happy to review code/design suggestions (the current API is a bit ad hoc and has basically evolved for the RLS and whatever crazy tool idea I was experimenting with at the time). To be clear about what 'plugin' means, we're talking about the pluggable lints facility? |
On the first steps towards this, we talked a little in the core team meeting today. We have the go ahead to include Clippy as a submodule in the repo (trivially easy) and build and run Clippy tests as part of the test suite (will need some modification to rustbuild) as long as the tests are able to fail without failing the whole test run (i.e., won't block PRs from landing). The next steps would be having Clippy CI blocking Rust CI, then adding Clippy to rustup and having that change ride the trains., but the core team would still like to wait before doing these things. |
Awesome! I guess I or @oli-obk will start poking at that when we have time. So currently the problem causing us to use a custom driver is basically is that If we put libclippy.so (a regular lint plugin) in the distribution, This is the "keeping it a regular plugin" step I was talking about. If we are to use a custom driver, I presume I guess having a I do not want to keep the roundabout dance that cargo-clippy currently does around, that is a major hack and causes issues with complex setups. |
The benefit of not having a plugin is that rustc can be improved in many ways for incremental compilation if it doesn't have to assume that plugins need access to everything. At least that's what I understood. @eddyb knows more. Is there anything speaking against simply compiling clippy into rustc as a regular dependency instead of a plugin? Anyway. If we generate a
We don't need to special case the build at all if one issue with the |
The benefit of not having plugins in the compiler is not having to worry about loading in the compiler something compiled by... the compiler who compiled the compiler. Not to mention, in the general case, plugins can have non-trivial interactions between themselves and custom drivers makes interactions explicit (if they even need to interact, at all). |
I think, for now at least, there are significant reasons not to do this and to keep Clippy a separate tool. It probably should always be something people opt-in to installing via Rustup, rather than have as a compiler option. We want to handle stability guarantees for tools separately from the compiler. Having Clippy as a dependency also makes it harder to break when making breaking changes to rustc. One of the goals with the tool integration work is to be as conservative as possible with the compiler. Where possible, we want to avoid stabilising extra flags or adding any features to the compiler. As far as possible, we should not constrain compiler devs making breaking changes. From a tools dev perspective, the advantages of the integration are that we get to know about breaking changes earlier, rather than having less breakage to deal with. Overall, a rustc-clippy custom driver looks like the best solution to me. |
Additionally, clippy has a lot of folks contributing to it and at least in part this is because it's easy to build and work on. With a custom driver this will likely continue to be the case, though you will need the appropriate nightly to be able to build clippy. (But this isn't that big a deal, it's only a big deal when clippy users have to worry about that, as is the case now) . The custom driver stuff can be a public but forever unstable API. |
So we have a small problem. When someone makes a change that breaks clippy and opens a PR against clippy to fix that breakage, they won't be able to reference their PR's commit from rustc before that commit has been merged. We can't merge their commit until their change has been merged into rustc, because there might be other rustc PRs which break clippy at the same time and want to get merged, too. Solutions:
|
So github already creates PR branches; As long as after the rustc PR is merged we use merge commits and not rebases, we should be fine. |
You can disable those in the repository settings |
Well, not exactly, you can always rebase locally and push. The default clippy uses is merge commits, the only time the discrepancy arises is when there's a conflict. |
I'm writing docs for this at the moment. In short, if there is a Clippy fix then it needs to be a Clippy branch on the Clippy repo and it needs to be preserved forever because we want to be able to rebuild Rust at any previous point in time. Then it doesn't matter how the PR is merged, as long as the branch in the Clippy repo (c.f., the author's repo) does not change. |
I would prefer being able to not have the branch provided we merge it normally. If we don't, we can always keep the branch. |
Submodules track commits, not branches. We can delete the branches as long as we don't rebase. |
Add clippy as a submodule ~~This builds clippy as part of `./x.py build` (locally and in CI).~~ This allows building clippy with `./x.py build src/tools/clippy` ~~Needs rust-dev-tools/dev-tools-team#18 (comment) to be resolved before it can be merged.~~ Contributers can simply open a PR to clippy and point the submodule at the `pull/$pr_number/head` branch. This does **not** build clippy or test the clippy test suite at all as per rust-dev-tools/dev-tools-team#18 (comment) r? @nrc cc @Manishearth @llogiq @mcarton @alexcrichton
Update: It's in the distribution (#43886), will be CId after rust-lang/rust#43628 |
Now that rls can be dropped from rustup via toolstate.toml, can I start implementing clippy distribution? |
@oli-obk some of the core team are meeting tomorrow to discuss next steps. I'm hoping to be able to turn on testing as the next step. We will probably want to wait a little longer before distributing. The experience with the RLS has not been super-smooth and we might want to iron some more wrinkles before distributing more tools |
I'm aware of that. The experience with The only advantage of the |
@oli-obk we discussed this yesterday (minutes coming soon), we can start testing Clippy on the CI now. We want to see how that goes plus get experience with RLS before distributing Clippy. We appreciate that the current situation sucks for Clippy. But if things go wrong it has the potential to be very disruptive for lots of Rust contributors and take a good chunk of time from core devs to sort out when we are in a bit of a crunch to the end of the year. This kind of thing is not as simple as 'back it out if it goes wrong' because user expectations are set when we distribute something like this, even if we are loud and clear about it being experimental, etc. If testing, etc. goes well we should be able to distribute Clippy early in the new year. |
https://rust-lang-nursery.github.io/rust-toolstate/ clippy has now been built the same system that currently builds rls and rustfmt in the compiler So I guess as a next step we can try distributing clippy? |
Yes, I think it is probably a good time! Let me check with Alex about infra stuff, and the core team to check they are OK about it. |
I talked to the core team about Clippy using Rustup for distribution and the answer was pretty much a firm 'no'. There are basically worried about the availability of Clippy on nightly. Some facts:
And some opinions:
On the bright side, there was agreement that Clippy is an important tool and we need to find some way of distributing it reliably and conveniently. Some things we can do next:
Sorry for the 'stop energy' here, but I am still very keen to get Clippy distributed on official channels and optimistic that this is a speed bump rather than a wall. |
I think waiting is fine, but overall I'm a bit surprised/confused by this response because some of the points stated seem to go against past discussions we've had.
I thought we'd discussed this recently? There are ways to mitigate breakage by moving bunches of clippy's utils into the compiler (and making more common tasks into utils so that you never interact directly with compiler functions). I was going to wait for it to be shipped with rustup so that it's easier to make these changes (we can make these changes atomically instead of having clippy break a lot in this process). But that's not strictly necessary, and these changes could be made within the clippy repo itself and then moved all at once. This is a bit frustrating because I recall having this conversation twice very recently (and a couple times in the past). We haven't started doing this work (because as mentioned I was waiting to move it into rustup first), but we could do it, and it seems like it's being assumed that it won't work? I don't think this will ever get us to rustfmt levels of stability, but it may get us at RLS levels. We'll still be breaking when people change the AST/HIR, and if there are major fundamental changes to how things work, but mostly it will be pretty stable.
Wasn't the plan to allow for nightlies to not contain clippy, and just have it so that It might put the nightlies in a slightly bad light, but IMO we're already currently in a very bad light because RLS and clippy are not stable. Most of the time people complain about Rust requiring nightlies these days they're talking about RLS, clippy, and sometimes Rocket. No amount of "just use
The majority of clippy breakages are breakages where the dev had to fix a whole bunch of other This even works if we're going to make it so that travis gates on a clippy build and nightlies must contain clippy: if clippy breaks tick the "allow contributors to push to this PR" thing and we'll fix it. Historically we've been pretty fast at fixing broken nightlies. The ability to just work with the PR instead of waiting for a nightly to break -- even if the PR author isn't helping -- would already be a major win for us. The only impact on the compiler would be that it may take an extra few hours, perhaps a day, until it gets r+d -- and let's face it, bors cycle times are already much worse than that (hoping to work a fix for that into homu eventually, but I have no bandwidth for homu work right now) |
Rereading this I might be coming off a bit harsh, apologies for that. I'm overall fine with the speed bump; just very confused. |
I'm not sure if this is on anybody's radar, but I have a partial solution for rls + clippy users: rust-lang/rust#48097 Essentially rls ships with clippy iff clippy builds, otherwise it ships without clippy. This won't help
This is the major point I think. The goal is not to get clippy into nightlies. It's to get it into stable. And we are confident that we can get clippy working for stable releases. |
Speaking not from a rustc dev's but from a users perspective: What is the short-term story here? What do I need to do to get a great setup with all the super-useful dev tools? Do you I need to install a known-good-and-complete nightly? Can I use the latest beta (assuming I don't need nightly-only features in my own code)? Can we extend rustup to automatically pick a known-good-and-complete nightly? From the perspective of someone telling people to try Rust: Can I say "install the VSCode plugin and click 'yes' when it asks you to automatically install some tools"? What needs to happen so that I can say this? |
We do have https://rust-lang-nursery.github.io/rust-toolstate/ so there is a way to programmatically get a nightly that has the desired tools. The vscode plugin could query that and select a good nightly to use |
It certainly is on my radar, I'm really excited about it! However, it doesn't help with Clippy's stability, only the integration of Clippy + RLS.
There might be something interesting here. If we never distribute Clippy with the nightly channel, we don't need to worry about it breaking! We'd have to figure out the mechanics of ensuring there is a working version ready for beta though.
That is kind of the big question here and what we've been solving with the RLS over the past 4 months or so. I think we're basically in a good place right now. Although tool breakage doesn't block landing a PR, it does block a release. So anytime you use Rustup you always have the tools you'd expect. The downside is that sometimes we skip nightlies altogether, although that is rare. Essentially, between that constraint, rust-toolstate, and a few other things, we're in a good place right now. The question is therefore not how we can get to a good place, but how we can stay in the current good place while we add Clippy to the mix of supported tools. |
That seems kinda backwards though? People still default to nightlies. But we can guarantee clippy in stable and let people opt in to having clippy on beta/nightlies with the caveat that you won't be able to update to a nightly that doesn't have clippy (or the caveat that some nightlies won't have clippy). It seems like no clippy on nightly is strictly worse than clippy on nightly, but sometimes. |
We have discussed this a few times, which is why I included it in my comment.
This sounds good and I think you should work on it. I don't have a good idea of how long a project this is. I've assumed that it would take quite a long time to implement and that the stability wins only come at the end. In any case, I think we need to prove the improved stability before we can block nightlies on Clippy. I think it is important that the design here is a lightweight abstraction layer in the compiler and the hard work is still done in Clippy, rather than moving the guts of Clippy into the compiler. This is what I mean about not increasing the maintenance burden on the compiler.
I don't think anyone is assuming it won't work. But we do want to see it work before we tighten the integration with Clippy.
This changed as we learned what users expect from the RLS. Even though we clearly messaged that nightly RLS would not always be available, users got pretty annoyed when it didn't work and this reflected badly on the RLS and on the whole Rust project. I would expect the same with Clippy.
I think this is a very different kind of frustration (and of course we want to address it asap, but...) - it is much easier to never offer something than to offer it and then take it away, especially if that happens unpredictably and inconsistently.
This approach has not really worked out. The reasoning is that it is already hard enough to get a PR into Rust and making contributors think about tool breakage (even if they don't have to do the fix themselves) is just too much to ask. We have the toolstate thing now which lets PRs land if they break tools and then emails the tool maintainers with the breaking PR. I think this is as much info as tools folk could hope to have without blocking Rust PRs. Does that clear up some things? I probably should have shared how the RLS integration was going as we went along as that would probably have helped you understand the core team thinking a bit better. |
Could they still use Cargo to install Clippy on nightly? I think we might need different names for the binaries, but otherwise it should work.
Some nightlies missing a tool is something we definitely don't want though. So we would need to block nightlies on Clippy, which we're not comfortable to do yet.
Whilst this is true technically, I think it is wrong due to the psychology of the thing: better to be consistently and predictably missing than to be inconsistently and unpredictably missing, even if you're missing more often. |
But this is different? There are two ways of doing partial nightlies:
The former will definitely lead to lots of frustration. But as for the latter? I don't see the average nightly user caring that they get the absolute latest nightly, as long as it's very recent. Skipping a nightly seems like no big deal.
(we're talking about different things re: broken nightlies)
If
As I already said, we get breakage less than once a week, I don't think it's something contributors need to worry about too much. But that's fine, this is only a problem if we want to block the build on clippy -- it seems like we don't have to. |
I implemented most of this in Rustup. One approach to trying to get Clippy distributed would be to press on down this road - we'd need to add a bit more to Rustup (e.g., if a component is missing on one nightly, then it is like it doesn't exist at all, whereas Just in terms of risk appetite, we'd need to wait a little while before doing this since we want to be sure the RLS is really solid before taking on more risk. Probably worth discussing in Berlin. |
Alright, going down that route seems better. (I was under the impression that this was always the plan) |
Rust distribution:
Wait for RLS/rustfmt distro issues to be worked outStability tracking - Clippy #18 (comment)The text was updated successfully, but these errors were encountered: