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

Add clippy as a submodule #43886

Merged
merged 6 commits into from
Sep 2, 2017
Merged

Add clippy as a submodule #43886

merged 6 commits into from
Sep 2, 2017

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Aug 15, 2017

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

@Manishearth
Copy link
Member

This seems to block CI on clippy builds, yeah?

It seems like rust-dev-tools/dev-tools-team#18 (comment) said we should do this too, but just want to check with @nrc again on that.

I'm very happy if rustc blocks on clippy builds in CI, but I'm just not sure if that's what nrc was going for.

@oli-obk
Copy link
Contributor Author

oli-obk commented Aug 15, 2017

This seems to block CI on clippy builds, yeah?

Yes that's how I read that comment, too. I don't think it's too much of a burden on developers to "just get it compiling again", since they just got the entire rustc compiling again and know the knobs to twist. The runtime effects of such a change can then be left to us, as they traditionally are much less complex to figure out (once you have written a few lints).

The only issue I see is that it requires a stage2 build due to a dependency on serde.

Note that currently this also builds cargo clippy. This can easily be circumvented by making cargo clippy an optional, but by-default feature and having rustc build without default features. I can do that in this PR if desired.

@Manishearth
Copy link
Member

since they just got the entire rustc compiling again and know the knobs to twist

We should document the process for fixing this somewhere before landing IMO.

(I can do a writeup if you want)

The only issue I see is that it requires a stage2 build due to a dependency on serde.

Because of toml?

Ideally libclippy.so or the rust-clippy driver won't read from toml at all, that's all cargo clippy's job.

Though passing this info down to rust-clippy without a format will be annoying.

@oli-obk
Copy link
Contributor Author

oli-obk commented Aug 15, 2017

We should document the process for fixing this somewhere before landing IMO.

done

Ideally libclippy.so or the rust-clippy driver won't read from toml at all, that's all cargo clippy's job.
Though passing this info down to rust-clippy without a format will be annoying.

We can probably pass these things as CLI flags, which are already parsed.

CONTRIBUTING.md Outdated
you can point the submodule at your pull request by calling

```
git checkout pulls/$id_of_your_pr/head
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might need a git fetch pulls/blah as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should test this workflow on a test repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm doing that right now with the Cargo.lock

@arielb1 arielb1 added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Aug 15, 2017
@oli-obk
Copy link
Contributor Author

oli-obk commented Aug 16, 2017

I'm not sure why this is marked S-wating-on-author, as I don't think there's anything left for me to address right now.

@Manishearth
Copy link
Member

probably because it's marked as WIP?

@oli-obk oli-obk changed the title WIP: Add clippy as a submodule Add clippy as a submodule Aug 16, 2017
@Manishearth
Copy link
Member

How regularly should we be updating this? Only in the event of breakage, or should we keep it in sync every day so that rustc contributors have to do less merge conflict work upgrading?

We probably should maintain a vendored branch on the clippy repo that tracks what is currently vendored in rustc for convenience.

@oli-obk
Copy link
Contributor Author

oli-obk commented Aug 17, 2017

We probably should maintain a vendored branch on the clippy repo that tracks what is currently vendored in rustc for convenience.

That makes sense. We can merge the vendored branch into master when the nightly is on travis, and open a PR here to update the submodule to clippy's master branch as often as possible. These could even be part of rollups, since they should only produce conflicts very rarely.

@nrc
Copy link
Member

nrc commented Aug 17, 2017

How regularly should we be updating this?

This is up to the Clippy devs. Updating means a PR that has to go through the bors process (though it should be a rollup), so it is not trivial. I tend to update the RLS every week or two, basically when I do a release of the client or there is a significant change.

@nrc
Copy link
Member

nrc commented Aug 17, 2017

Yes that's how I read that comment, too.

Sorry, I was not 100% clear in that comment. I meant that building and testing should be possible, but neither should block landing PRs.

@nrc nrc added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 17, 2017
@nrc
Copy link
Member

nrc commented Aug 17, 2017

This looks good to me (modulo the building blocking PRs thing).

@Mark-Simulacrum - could you r? the build system changes please?

@Mark-Simulacrum
Copy link
Member

Build system changes seem fine. Note that this won't dist clippy in the current configuration, but that's presumably intentional.

@oli-obk
Copy link
Contributor Author

oli-obk commented Aug 18, 2017

This looks good to me (modulo the building blocking PRs thing).

I'm not sure what the point of running it inside CI is, if noone ever notices that the build breaks. Should I turn it on so it is unconditionally run and tested in dev mode (so if someone builds locally), but not on any CI?

Or is this where we add the exception file to the build system, so if clippy breaks, one adds it to the file and it's not built anymore on CI? This way everbody notices when they break clippy and have a choice between ignoring it and @ mentioning us or fixing it?

@nrc
Copy link
Member

nrc commented Aug 22, 2017

I'm not sure what the point of running it inside CI is, if noone ever notices that the build breaks.

It is a more long-term goal that Clippy block CI, the core team are not ready to do that until at least the RLS rides the trains to beta (it is considered too risky to have multiple tools doing new things).

Should I turn it on so it is unconditionally run and tested in dev mode (so if someone builds locally), but not on any CI?

That sounds good to me.

@alexcrichton
Copy link
Member

Oh wait I think no, let's please not run tests yet. We are not in a position to do so right now. It wouldn't be a great experience to download broken trees from git "by default" as I suspect the clippy submodule will be broken quite often. Although we can land PRs that'd just hurt developers.

I've commented elsewhere about how we're going to run tests, but that support isn't here yet. I don't personally know why we'd add build support in tree before there's infrastructure to actually run tests for it, but I won't stop it if others would like it.

@oli-obk
Copy link
Contributor Author

oli-obk commented Aug 22, 2017

It is a more long-term goal that Clippy block CI, the core team are not ready to do that until at least the RLS rides the trains to beta (it is considered too risky to have multiple tools doing new things).

Makes total sense.

Oh wait I think no, let's please not run tests yet. We are not in a position to do so right now.

I'm very confused now. This PR only builds clippy. It does not run its tests.

It wouldn't be a great experience to download broken trees from git "by default"

broken as in doesn't build or broken as in "that commit doesn't exist, git will complain"? Because it'll only be the former.

I suspect the clippy submodule will be broken quite often.

The goal of this PR is to ensure that it will never be broken again, because it'll only break if the developer changes something that would break it. That developer is at the same time in the unique position to know exactly how to fix it (since they just had to fix it all over rustc).

Although we can land PRs that'd just hurt developers.

Soo... simply as stated above

I turn it on so it is unconditionally run and tested in dev mode (so if someone builds locally), but not on any CI?

@alexcrichton
Copy link
Member

The goal of this PR, in that case, is not satisfiable right now. We aren't in a position to ensure that "clippy never breaks again".

@oli-obk
Copy link
Contributor Author

oli-obk commented Aug 22, 2017

That's fine, it doesn't have to happen in this PR.

If I made it easy to tune out the clippy building failure, but have it still happen by default on local builds, would that be ok?

I mean it could be as simple as uncommenting an entry in a ignore-tools-breakage.toml.

This way, if your PR breaks clippy, you either fix clippy, or turn building it off for everyone who comes after your build. In the first case, we get a PR at clippy, in the second case, someone should ping us, we create a new PR that reenables clippy together with the fixed clippy.

This means noone ever gets a broken clippy without it being their fault.

@Manishearth
Copy link
Member

I don't personally know why we'd add build support in tree before there's infrastructure to actually run tests for it, but I won't stop it if others would like it.

Clippy tests don't break often. Mostly clippy-side changes break them, and we CI Clippy side. If a rustc change breaks clippy that's the concern, and we're fine with having tests broken for a short while as we fix things.

This PR has two goals. It starts giving Clippy authors early warning about breakage, and gives PR authors the ability to fix it. Many clippy breakages are from rustc changes that contain mostly automated fixes to the rest of librustc_* and to fix this clippy authors have to go back and figure this out again. It should really be much less effort overall with authors helping. Also keeps clippy's use case of an API in mind, so if an API needs to be changed in a way that completely removed the functionality clippy needs, this can be discussed at the time.

The second goal is to prototype the eventual contribution model. This way we can work towards a smooth integration and work out all the kinks before all the parts are ready.

@alexcrichton
Copy link
Member

@oli-obk

This way, if your PR breaks clippy, you either fix clippy, or turn building it off for everyone who comes after your build. In the first case, we get a PR at clippy, in the second case, someone should ping us, we create a new PR that reenables clippy together with the fixed clippy.

Yes that's what the "planned infrastructure" is currently thought to look roughly like. This doesn't exist today, however, so no, I do not think we should enable anything for local builds.

@oli-obk
Copy link
Contributor Author

oli-obk commented Aug 22, 2017

Ok. So I'm kind of lost here now wrt what I should do in this PR. I can create said infrastructure if that is desirable and noone has existing plans or already started working on it. Or should I just disable all the clippy building and require one to run ./x.py build src/tools/clippy?

@arielb1 arielb1 removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 22, 2017
@alexcrichton
Copy link
Member

Or should I just disable all the clippy building and require one to run ./x.py build src/tools/clippy?

Isn't that what this PR does?

I don't mind adding more infrastructure here, although I'm not sure if we've hammered out precisely what we'd like it to look like. The discussion here leads me to believe that at least mine and @nrc's perceptions of these workflows may differ?

@oli-obk
Copy link
Contributor Author

oli-obk commented Aug 24, 2017

Isn't that what this PR does?

No, it also builds clippy if you just do ./x.py build.

@oli-obk
Copy link
Contributor Author

oli-obk commented Aug 24, 2017

I disabled building clippy by default and edited the OP message to reflect the current state of the PR

@alexcrichton
Copy link
Member

@oli-obk I've created a tracking issue for the requirements of what we think the infrastructure for running tests would look like.

@carols10cents carols10cents added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 28, 2017
@carols10cents
Copy link
Member

carols10cents commented Aug 28, 2017

It sounds like this is back in the reviewers' court. @alexcrichton @nrc what are the next steps on this? (also it looks like travis passed even though it says it's still running)

@alexcrichton
Copy link
Member

I believe this needs an r+ from @nrc

@shepmaster shepmaster added the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label Sep 1, 2017
@shepmaster
Copy link
Member

@rust-lang/dev-tools It has been over 6 days since the last comment from a reviewer. Perhaps someone besides @nrc can step up?

@@ -298,6 +298,32 @@ Speaking of tests, Rust has a comprehensive test suite. More information about
it can be found
[here](https://github.com/rust-lang/rust-wiki-backup/blob/master/Note-testsuite.md).

### External Dependencies

Currently building Rust will also build the following external projects:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this documentation may wish to be updated with the current state of the PR

@nrc
Copy link
Member

nrc commented Sep 2, 2017

@bors: r+ (sorry for the delay)

@bors
Copy link
Contributor

bors commented Sep 2, 2017

📌 Commit 20f1e68 has been approved by nrc

@bors
Copy link
Contributor

bors commented Sep 2, 2017

⌛ Testing commit 20f1e68 with merge b3b5b990c426f26e41d65475e6ac33f9e9e5aeb3...

@bors
Copy link
Contributor

bors commented Sep 2, 2017

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Sep 2, 2017

@bors retry #38618

dist-i586-gnu-i686-musl failed:

[01:23:36] test sync::mpsc::sync_tests::fmt_debug_recv ... ok
[01:23:36] test sync::mpsc::sync_tests::fmt_debug_sender ... ok
[01:23:36] test sync::mpsc::sync_tests::fmt_debug_sync_sender ... ok
[01:23:36] error: An unknown error occurred
[01:23:36] 
[01:23:36] To learn more, run the command again with --verbose.
[01:23:36] 
[01:23:36] 
[01:23:36] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "-j" "4" "--target" "i686-unknown-linux-musl" "--release" "--locked" "--color" "always" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "std:0.0.0" "-p" "alloc:0.0.0" "-p" "libc:0.0.0" "-p" "compiler_builtins:0.0.0" "-p" "collections:0.0.0" "-p" "unwind:0.0.0" "-p" "core:0.0.0" "-p" "rand:0.0.0" "-p" "panic_abort:0.0.0" "-p" "alloc_system:0.0.0" "-p" "std_unicode:0.0.0" "--"
[01:23:36] expected success, got: exit code: 101
[01:23:36] 
[01:23:36] 
[01:23:36] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --target i686-unknown-linux-musl --target i586-unknown-linux-gnu
[01:23:36] Build completed unsuccessfully in 1:21:36

@bors
Copy link
Contributor

bors commented Sep 2, 2017

⌛ Testing commit 20f1e68 with merge 204c0a4...

bors added a commit that referenced this pull request Sep 2, 2017
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
@bors
Copy link
Contributor

bors commented Sep 2, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: nrc
Pushing 204c0a4 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants