8991 Commits

Author SHA1 Message Date
Eric Huss
0279e8e63a Fix using global options before an alias. 2020-01-31 13:56:06 -08:00
bors
2a0f0c8f38 Auto merge of #7829 - Mark-Simulacrum:fix-progress-panics, r=ehuss
Store maximum queue length

Previously, the queue length was constantly decreasing as we built crates, which
meant that we were incorrectly displaying the progress bar. In debug builds,
this even led to panics (due to underflow on subtraction).

Not sure if we can add a test case for this. I have made the panic unconditional on release/debug though by explicitly checking that current is less than the maximum for the progress bar.

Fixes https://github.com/rust-lang/cargo/pull/7731#issuecomment-578358824.
2020-01-26 01:15:51 +00:00
Mark Rousskov
dc6d219d8f Store maximum queue length
Previously, the queue length was constantly decreasing as we built crates, which
meant that we were incorrectly displaying the progress bar. In debug builds,
this even led to panics (due to underflow on subtraction).
2020-01-25 14:22:27 -05:00
bors
b68b0978ab Auto merge of #7826 - eddyb:recursion-limit-diagnostic, r=Eh2406
test: allow some flexibility in check::error_from_deep_recursion's expected diagnostic.

This should unblock https://github.com/rust-lang/rust/pull/68407, by loosening the expected output pattern.

As per https://github.com/rust-lang/rust/pull/68407#issuecomment-578189644, this is the change in the diagnostic:
```diff
-recursion limit reached while expanding the macro `m`
+recursion limit reached while expanding `m!`
```

Ideally I would use something like this regex:
```
recursion limit reached while expanding (the macro `m`|`m!`)
```
but AFAIK these tests don't support regexes.
2020-01-24 18:26:23 +00:00
Eduard-Mihai Burtescu
4d3b738a3c test: allow some flexibility in check::error_from_deep_recursion's expected diagnostic. 2020-01-24 18:40:34 +02:00
bors
6de33f0ccd Auto merge of #7818 - giraffate:add_some_tests, r=alexcrichton
Add tests for `cargo owner -a/-r` / `cargo yank --undo`

Follow up 5e15286.

There were no tests for `cargo owner -a/-r` and `cargo yank --undo`. However, These commands in tests had empty response. So I also update response handling with reference to 7dd0f932a8.
2020-01-23 15:15:49 +00:00
Takayuki Nakata
a492cfc376 Revert updating a doc 2020-01-23 09:13:13 +09:00
bors
8ee3d927e6 Auto merge of #7731 - Mark-Simulacrum:chatty-jobserver, r=alexcrichton
Scalable jobserver for rustc

This refactors the job queue code for support of [per-rustc process jobservers](https://github.com/rust-lang/rust/pull/67398). Furthermore, it also cleans up the code and refactors the main loop to be more amenable to understanding (splitting into methods and such).

Assignment of tokens to either rustc "threads" or processes is dedicated to the main loop, which proceeds in a strict "least recently requested" fashion among both thread and process token requests. Specifically, we will first allocate tokens to all pending process token requests (i.e., high-level units of work), and then (in per-rustc jobserver mode) follow up by assigning any remaining tokens to rustcs, again in the order that requests came into cargo (first request served first).

It's not quite clear that that model is good (no modeling or so has been done). On the other hand this strategy should mean that long-running crates will get more thread tokens once we bottom out in terms of rustc parallelism than short-running crates, which means that crates like syn which start early on but finish pretty late should hopefully get more parallelism nicely (without any more complex heuristics).

One plausible change that may be worth exploring is making the assignment prefer earlier rustc's, globally, rather than first attempting to spawn new crates and only then increasing parallelism for old crates. syn for example frequently gets compiled in the early storm of dozens of crates so is somewhat unlikely to have parallelism, until fairly late in its compilation.

We also currently conflate under this model the rayon threads and codegen threads. Eventually inside rustc those will probably(?) also be just one thing, and the rustc side of this implementation provides no information as to what the token request is for so we can't do better here yet.
2020-01-22 22:42:20 +00:00
Mark Rousskov
7e3e1b128c Move token truncation to just before waiting
This also moves and enhances the message logging the state before blocking.
2020-01-22 14:32:59 -05:00
Mark Rousskov
6117f526c0 Stop threading Client through into the NeedsToken message 2020-01-22 14:20:41 -05:00
Mark Rousskov
1204a527c7 Elaborate on some documentation 2020-01-22 14:20:41 -05:00
Mark Rousskov
25bf99bcc3 Refactor to_send_clients to use a BTreeMap
This is both a performance optimization (avoiding O(n) shifting from the
beginning), and communicates intent in a nicer way overall.

It is plausible that we will eventually want to tie this data structure to
something like the DependencyQueue, i.e., to get more information on which rustc
to give tokens to. An old rustc with a very late dependency edge is less
important than one we'll need sooner, probably.
2020-01-22 14:20:41 -05:00
Mark Rousskov
4bd074e7a5 Use an expect instead of directly panicking 2020-01-22 14:20:41 -05:00
Mark Rousskov
ec4cce9f65 Refactor rustc thread granting loop 2020-01-22 14:20:41 -05:00
Mark Rousskov
50a6083404 Reintroduce crossbeam threads
Turns out, these are actually necessary -- we will deadlock otherwise, though
it's not entirely obvious why.
2020-01-22 14:20:41 -05:00
Mark Rousskov
1988dd92b8 Pop thread token requests from the front
This ensures we have a first come first served ordering for both thread and
process tokens.
2020-01-22 14:20:41 -05:00
Mark Rousskov
5a9af54205 Add some commentary 2020-01-22 14:20:41 -05:00
Mark Rousskov
1d9fdee250 Move transient state to separate struct 2020-01-22 14:20:41 -05:00
Mark Rousskov
78afa068c2 Take JobQueue by-value in drain_the_queue 2020-01-22 14:20:41 -05:00
Mark Rousskov
c5f4690fd9 Document ordering constraint on providing thread tokens 2020-01-22 14:20:41 -05:00
Mark Rousskov
ae7aba2302 Refactor rustc_tokens to a HashMap 2020-01-22 14:20:41 -05:00
Mark Rousskov
b448d92399 Do not send acquired tokens to waiting rustc threads
This removes the ad-hoc token re-send in the message processing; this sort of
decision should be left up to the main loop which manages tokens.

Notably, the behavior change here is that new tokens will go solely to spawning
new rustc *processes* rather than increasing rustc internal parallelism, unless
we can't spawn new processes.

Otherwise, before this commit, we may be saturating a single rustc with tokens
rather than creating lots of rustcs that can work in parallel. In particular in
the beginning of a build, it's likely that this is worse (i.e., crates are small
and rustc internal parallelism is not at that point all that helpful) since it
severely limits the benefits of pipelining and generally makes the build
nearly serial.
2020-01-22 14:20:41 -05:00
Mark Rousskov
0d722a4d83 Split waiting for an event out of the primary drainer
This has the slight behavior change where we won't ask for new dependencies and
so forth if no events have been received but I believe that there's no activity
that can happen if an event hasn't occurred (i.e., no state change has occurred)
so there's no need for us to actually do anything in practice.

To make sure we still record CPU usage and such sufficiently often that is also
moved into the inner "waiting for events" loop.
2020-01-22 14:20:41 -05:00
Mark Rousskov
445de0ed4f Split out event handler into separate function 2020-01-22 14:16:17 -05:00
Mark Rousskov
f6deb98ace Split out granting rustc token requests 2020-01-22 14:16:17 -05:00
Mark Rousskov
f07fbb2f02 Split out work spawning 2020-01-22 14:16:17 -05:00
Mark Rousskov
90ef289c70 Move local variables to struct fields
This will facilitate splitting drain_the_queue into methods
2020-01-22 14:16:17 -05:00
Mark Rousskov
e2f4ce114d Drop crossbeam scopes from job queue
These were unused for a long time (comment added in April 2019) and add
some complexity to API design.
2020-01-22 14:16:17 -05:00
Mark Rousskov
f7c6d04b05 Introduce newtype wrapping JobId 2020-01-22 14:16:17 -05:00
Mark Rousskov
494b3c0af5 Gate Cargo changes behind -Zjobserver-per-rustc 2020-01-22 14:16:16 -05:00
Mark Rousskov
cdcd9ade8d Add documentation about the job queue and rustc 2020-01-22 14:15:47 -05:00
Mark Rousskov
877fe690d9 Record the amount of rustc internal parallelism 2020-01-22 14:15:47 -05:00
Mark Rousskov
4a8237f6ad Communicate jobserver information with each rustc 2020-01-22 14:15:47 -05:00
Mark Rousskov
ec80cf90b0 Wire up methods for informing job queue of rustc jobserver state 2020-01-22 14:15:46 -05:00
bors
9d11cd19a9 Auto merge of #7819 - ehuss:fix-replay-newlines, r=alexcrichton
Fix cache replay including extra newlines.

The compiler output cache replay was changed in #7737 to use `BufReader::read_line` instead of `str::lines`. `read_line`, unlike `lines`, includes the trailing line ending. The code is written assuming that the line endings are stripped, so make sure they are stripped here, too.

This only happens for non-JSON messages, like `RUSTC_LOG`.
2020-01-22 00:59:36 +00:00
Takayuki Nakata
58ae3d06b9 Revert fixes of response handling and fix tests 2020-01-22 09:19:59 +09:00
Eric Huss
7be3c2f09b Fix cache replay including extra newlines. 2020-01-21 16:03:35 -08:00
bors
f6449ba236 Auto merge of #7798 - jnbr:dylib_path, r=alexcrichton
Fix wrong directories in host_libdir.

This fixes a regression from #7482 where the sysroot_target_libdir leaks into the host libdir. This can cause problems when the dynamic linker does not ignore the target libraries but tries to load them instead. This happens for example when building on x86_64-musl for aarch64-musl.
2020-01-21 16:15:39 +00:00
Takayuki Nakata
798f9942c8 Update response handling to add tests for cargo yank --undo
Follow up 5e152863f.
2020-01-21 09:09:39 +09:00
Takayuki Nakata
e632bdb906 Update response handling to add tests for cargo owner -a/-r
Follow up 5e152863f.
2020-01-21 09:06:06 +09:00
bors
3a5f04660e Auto merge of #7815 - rust-lang:dependabot/cargo/humantime-2.0.0, r=Eh2406
Update humantime requirement from 1.2.0 to 2.0.0

Updates the requirements on [humantime](https://github.com/tailhook/humantime) to permit the latest version.
<details>
<summary>Commits</summary>
<ul>
<li><a href="d478f8a787"><code>d478f8a</code></a> Version bumped to v2.0.0</li>
<li><a href="49f11fdc2a"><code>49f11fd</code></a> Another improvement of the error message</li>
<li><a href="8a13b047ca"><code>8a13b04</code></a> Nicer error message for plain numeric duration</li>
<li><a href="edfa493e8c"><code>edfa493</code></a> vagga.yaml: upgrade rust to 1.31.0</li>
<li><a href="8b8d748566"><code>8b8d748</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/tailhook/humantime/issues/13">#13</a> from gh0st42/master</li>
<li><a href="da7723529f"><code>da77235</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/tailhook/humantime/issues/12">#12</a> from koushiro/works</li>
<li><a href="227d7e591d"><code>227d7e5</code></a> Made crate unsafe free and forbid unsafe</li>
<li><a href="b7da4ab6ad"><code>b7da4ab</code></a> Downgrade MSRV to 1.31</li>
<li><a href="4a40682595"><code>4a40682</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/tailhook/humantime/issues/11">#11</a> from koushiro/apply-rustfmt-and-clippy</li>
<li><a href="f00dbbae37"><code>f00dbba</code></a> Apply suggestions</li>
<li>Additional commits viewable in <a href="https://github.com/tailhook/humantime/compare/v1.2.0...v2.0.0">compare view</a></li>
</ul>
</details>
<br />

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)

</details>
2020-01-20 20:33:50 +00:00
bors
1c4d6eda40 Auto merge of #7817 - ehuss:fix-doc-target-test, r=Eh2406
Fix doc_target test which no longer works on stable/beta.

https://github.com/rust-lang/rust/pull/67989 changed it so that `#![feature]` requires nightly.
2020-01-20 20:12:59 +00:00
Eric Huss
10e9bc9dfe Fix doc_target test which no longer works on stable/beta. 2020-01-20 11:16:53 -08:00
dependabot-preview[bot]
2be0acc16b
Update humantime requirement from 1.2.0 to 2.0.0
Updates the requirements on [humantime](https://github.com/tailhook/humantime) to permit the latest version.
- [Release notes](https://github.com/tailhook/humantime/releases)
- [Commits](https://github.com/tailhook/humantime/compare/v1.2.0...v2.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-20 05:27:58 +00:00
bors
982622252a Auto merge of #7814 - ehuss:fix-em-dash, r=Eh2406
Fix some erroneous em-dashes in man pages.

Unfortunately asciidoctor has a built-in substitution pass that cannot be disabled.

Fixes #7807.
2020-01-18 20:25:48 +00:00
bors
426fae51f3 Auto merge of #7808 - matthiaskrgr:clippy_v10, r=ehuss
fix some clippy warnings
2020-01-18 19:14:12 +00:00
Eric Huss
a4dccf9da3 Fix some erroneous em-dashes in man pages. 2020-01-18 11:02:18 -08:00
Matthias Krüger
a6a395c690 fix some clippy warnings 2020-01-17 12:20:11 +01:00
bors
4e0d2f1a16 Auto merge of #7803 - alexcrichton:less-overflow, r=Eh2406
Don't assume iowait always increases on Linux

According to [documentation] looks like this value is documented as it
can decrease, so let's handle that without overflowing.

[documentation]: http://man7.org/linux/man-pages/man5/proc.5.html
2020-01-15 15:34:14 +00:00
bors
c22380da32 Auto merge of #7800 - ehuss:random-doc-comments, r=Eh2406
Add and update some doc comments.

Just some random things that I felt could use clarification.
2020-01-15 15:14:37 +00:00