bors [Sun, 18 Nov 2018 08:12:27 +0000 (08:12 +0000)]
Auto merge of #6328 - ehuss:rename-cross-build-output, r=alexcrichton
Fix renaming directory project using build scripts with cross-compiling.
The rename-protection introduced in #4818 checks for paths with a prefix of `/…/target/debug`, but this does not work for paths used during cross-compiling.
This change checks for paths with the full `OUT_DIR` prefix, and the `build/PKG/root-output` file now includes that full `OUT_DIR` instead of `/…/target/debug`.
This also includes a few other changes:
- Support fixing KIND=PATH style paths.
- Support fixing paths in metadata (like `cargo:root=…` or `cargo:include=…` which are common).
- Adds a "version" value to the metadata hash to ensure that cargo doesn't get confused with the new `root-output` file format.
bors [Sun, 18 Nov 2018 07:49:10 +0000 (07:49 +0000)]
Auto merge of #6327 - ehuss:add_plugin_deps-tests, r=alexcrichton
Fix add_plugin_deps-related tests.
These tests were modified in #3974 in such a way that they stopped testing the `add_plugin_deps` code path. The tests can't be directly reverted because #3651 changed it so that dylib paths must be within the root output directory. I compromised by just copying the dylib into `$OUT_DIR`.
bors [Thu, 15 Nov 2018 19:13:04 +0000 (19:13 +0000)]
Auto merge of #6311 - alexcrichton:stabilize-renames, r=the-whole-team
Stabilize the `rename-dependency` feature
This commit stabilizes Cargo's `rename-dependency` feature which allows
renaming packages in `Cargo.toml`, enabling importing multiple versions
of a single crate or simply avoiding a `use foo as bar` in `src/lib.rs`.
bors [Wed, 14 Nov 2018 17:06:25 +0000 (17:06 +0000)]
Auto merge of #6317 - alexcrichton:zlib, r=dwijnand
Enable the `zlib` feature of `flate2`
We're already pulling in zlib for other dependencies like curl/libgit2
so there's not really much use in duplicating the compression code with
miniz, so let's instruct `flate2` to use libz as well to compress and
decompress chunks.
Alex Crichton [Wed, 14 Nov 2018 15:56:43 +0000 (07:56 -0800)]
Enable the `zlib` feature of `flate2`
We're already pulling in zlib for other dependencies like curl/libgit2
so there's not really much use in duplicating the compression code with
miniz, so let's instruct `flate2` to use libz as well to compress and
decompress chunks.
bors [Wed, 14 Nov 2018 15:06:17 +0000 (15:06 +0000)]
Auto merge of #6309 - ehuss:bench-build-profile, r=alexcrichton
Use "test" profile for `cargo build` benchmarks.
When using `cargo build` (without `--release`), build benchmarks using the "test" profile. This was causing some confusion where the benchmark is placed in the `target/debug` directory, and also causing some duplicates that may not be expected. It also makes it easier to debug benchmarks (previously you had to edit the `[profile.bench]` profile).
bors [Wed, 14 Nov 2018 04:27:13 +0000 (04:27 +0000)]
Auto merge of #6312 - alexcrichton:fix-broken, r=ehuss
fix: Don't back out changes with `--broken-code`
This commit updates the behavior of `cargo fix` when the `--broken-code`
flag is passed to Cargo. Previously Cargo would always back out
automatically applied changes to files whenever the fixed code failed to
compile. Now, with the `--broken-code` flag, fixed code is left as-is.
This means that if the fixed code can be more easily inspected by
humans to detect bugs and such.
The main use case intended here is that if you're working with a large
code base then lints like the edition idiom lints aren't 100% finished
yet to work as smoothly as `cargo fix`. The idiom lints are often
useful, however, to transition code to be idiomatic (who would have
guessed!) in the new edition.
To ease the experience of using not-quite-ready lints this flag can be
used to hopefully "fix 90% of lint warnings" and then the remaining
compiler errors can be sifted through manually. The intention is that we
have edition documentation indicating this workflow which also
encourages filing bugs for anything that fails to fix, and hopefully
this new behavior will make it easier for us to narrow down what the
minimal test case is too!
Alex Crichton [Tue, 13 Nov 2018 20:08:57 +0000 (12:08 -0800)]
fix: Don't back out changes with `--broken-code`
This commit updates the behavior of `cargo fix` when the `--broken-code`
flag is passed to Cargo. Previously Cargo would always back out
automatically applied changes to files whenever the fixed code failed to
compile. Now, with the `--broken-code` flag, fixed code is left as-is.
This means that if the fixed code can be more easily inspected by
humans to detect bugs and such.
The main use case intended here is that if you're working with a large
code base then lints like the edition idiom lints aren't 100% finished
yet to work as smoothly as `cargo fix`. The idiom lints are often
useful, however, to transition code to be idiomatic (who would have
guessed!) in the new edition.
To ease the experience of using not-quite-ready lints this flag can be
used to hopefully "fix 90% of lint warnings" and then the remaining
compiler errors can be sifted through manually. The intention is that we
have edition documentation indicating this workflow which also
encourages filing bugs for anything that fails to fix, and hopefully
this new behavior will make it easier for us to narrow down what the
minimal test case is too!
bors [Wed, 14 Nov 2018 02:08:45 +0000 (02:08 +0000)]
Auto merge of #6308 - ehuss:output-collision, r=alexcrichton
Check for duplicate output filenames.
This generates an error if it detects that different units would output the same file name. This can happen in a few situations:
- Multiple targets in a workspace use the same name.
- `--out-dir` in some cases (like `examples` because it does not include the directory).
- Bugs in cargo (like #5524, #5444)
This includes a few cleanups/consolidations:
- `export_path` added to `OutputFile` so there is one place where the `--out-dir` filename logic is located.
- `TargetKind::description()` added for a simple way to get a human-readable name of a target kind.
- The `PartialOrd` changes are a slight performance improvement (overall things are now slightly faster even though it is doing more work).
Alex Crichton [Tue, 13 Nov 2018 19:37:49 +0000 (11:37 -0800)]
Stabilize the `rename-dependency` feature
This commit stabilizes Cargo's `rename-dependency` feature which allows
renaming packages in `Cargo.toml`, enabling importing multiple versions
of a single crate or simply avoiding a `use foo as bar` in `src/lib.rs`.
bors [Mon, 12 Nov 2018 23:53:34 +0000 (23:53 +0000)]
Auto merge of #6304 - rust-lang:dependabot/cargo/env_logger-0.6.0, r=alexcrichton
Update env_logger requirement from 0.5.11 to 0.6.0
Updates the requirements on [env_logger](https://github.com/sebasmagri/env_logger) to permit the latest version.
<details>
<summary>Release notes</summary>
*Sourced from [env_logger's releases](https://github.com/sebasmagri/env_logger/releases).*
> ## 0.6.0
> # Key Changes
>
> - Set a policy for changes to the default format
> - Make all dependencies besides `log` optional (but enabled by default)
>
> # Breaking Changes
>
> - The default format is not considered stable across patch versions. The best way to get a stable format for later ripgrepping is to define a custom one.
> - All dependencies have been made optional except for `log`. That means compiling `env_logger` with `default-features=false` will result in a different experience than in `0.5.x`.
>
> # Contributions
>
> - [**hcpl**](https://github.com/hcpl) [Test with `-Z minimal-versions` on CI](https://github-redirect.dependabot.com/sebasmagri/env_logger/pull/114)
> - [**afck**](https://github.com/afck) [Add missing RFC3339 URL to fix rustdoc](https://github-redirect.dependabot.com/sebasmagri/env_logger/pull/105)
> - [Make all dependencies optional](https://github-redirect.dependabot.com/sebasmagri/env_logger/pull/100)
> - [Rework the default format](https://github-redirect.dependabot.com/sebasmagri/env_logger/pull/82)
> - [Don't clobber a previously set level filter](https://github-redirect.dependabot.com/sebasmagri/env_logger/pull/117)
>
> # More Details
>
> ## Disabling dependencies
>
> Using `default-features=false` will disable all dependencies of `env_logger` besides `log`. This will reduce compile times and alter the default format by disabling colours and timestamps.
>
> Disabling default dependencies is the recommended way to use `env_logger` for libraries that only need it for logging in tests.
</details>
<details>
<summary>Commits</summary>
- See full diff in [compare view](https://github.com/sebasmagri/env_logger/commits/v0.6.0)
</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`.
---
<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 cancel merge` will cancel a previously requested merge
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major 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)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
Finally, you can contact us by mentioning @dependabot.
bors [Mon, 12 Nov 2018 18:04:33 +0000 (18:04 +0000)]
Auto merge of #6303 - integer32llc:open-ended-publish-warnings, r=alexcrichton
Support untyped warnings from registries with successful publish
This adds a field "other" to the warnings deserialized from a successful publish response from a registry.
This is [part of our plan to eventually require an email address to publish on crates.io to comply with DMCA](https://github.com/rust-lang/crates-io-cargo-teams/issues/8). The TL;DR of that is we plan to warn for a release cycle when you publish without a verified email address once this change makes it to stable.
I'm opting to add an "other" field rather than another field like the invalid badges/categories fields for a few reasons:
- The warning we're planning on adding about emails will only exist for 6 weeks; those other warnings have happened in the past and will continue to happen.
- There may be other transient warnings on publish that we'd like to send from crates.io in the future; it'd be nice to have a way of doing that without having to update cargo as well.
- Other registries may have different warnings than we could ever anticipate in cargo; if usage of alternate registries grows, it'd be nice to give them a mechanism to warn as well.
I've tested:
- Cargo compiled with this change against a crates.io instance that doesn't return `other` warnings
- Cargo compiled with this change against a crates.io instance that DOES return `other` warnings
- Current Cargo against a crates.io instance that does return `other` warnings
and they all behaved as I expected.
I haven't added any tests because there aren't any tests that inject registry responses, and while I think cargo should have some of those eventually, I'm not going to add that infrastructure without discussing it with lots of folks first :)
I know there's a soft feature freeze right now, buuuuut [it's wafer thin](https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Fs4.thcdn.com%2Fproductimg%2F0%2F600%2F600%2F27%2F10284327-1288263770-74000.jpg&f=1)!! It doesn't add any surface area to the CLI or manifest format! ❤️
dependabot[bot] [Mon, 12 Nov 2018 05:44:45 +0000 (05:44 +0000)]
Update env_logger requirement from 0.5.11 to 0.6.0
Updates the requirements on [env_logger](https://github.com/sebasmagri/env_logger) to permit the latest version.
- [Release notes](https://github.com/sebasmagri/env_logger/releases)
- [Commits](https://github.com/sebasmagri/env_logger/commits/v0.6.0)
bors [Fri, 9 Nov 2018 23:56:39 +0000 (23:56 +0000)]
Auto merge of #6292 - ehuss:no-rmeta-hardlink, r=alexcrichton
Don't hardlink rmeta files.
`.rmeta` files shouldn't be needed in the main directory, and since rustc started outputing rmeta files for binaries, there are name collisions between bins and libs of the same name.
bors [Fri, 9 Nov 2018 20:54:45 +0000 (20:54 +0000)]
Auto merge of #6283 - Eh2406:slow-case, r=alexcrichton
Use a ad hoc trie to avoid slow cases
This adds a test for the pure case described [here](https://github.com/rust-lang/cargo/issues/6258#issuecomment-436437923). When added, this test will time out in debug (~20 sec release) with an `N` of 3.
Looking with a profiler, it is spending most of its time in [`Vec.contains`](https://github.com/rust-lang/cargo/blob/d08fd375db0014f097ee3fbdc1c595b632669f6a/src/cargo/core/resolver/conflict_cache.rs#L84). Keeping a deduplicated list with contains is `O(n^2)`, so let's change things to be `Ord` so we can use a btree to deduplicate.
Now the profiler claimed that we are spending our time [searching that `Vec`](https://github.com/rust-lang/cargo/blob/d08fd375db0014f097ee3fbdc1c595b632669f6a/src/cargo/core/resolver/conflict_cache.rs#L66). So time to work on that "vaporware", the simplest thing I could think of that lets us check for is_active in better then `O(n)` is nested hashmaps. Each hashmap has keys of a shared Id, and values of hashmaps representing all the conflicts that use that Id. When searching if the key is not active then we need not look at any of its descendants.
There are lots of ways to make this better but even this much gets the test to pass with `N` of 3. So maybe we can justify the improvements with `N` of 4? No, eavan in debug `N` of 4 hits the [50k limit](https://github.com/rust-lang/cargo/blob/d08fd375db0014f097ee3fbdc1c595b632669f6a/src/cargo/core/resolver/types.rs#L55), so the that is as far as we need to go on the conflict_cache.
bors [Fri, 9 Nov 2018 18:58:47 +0000 (18:58 +0000)]
Auto merge of #6271 - alexcrichton:h2, r=ehuss
Enable HTTP/2 by default
This commit switches Cargo to using HTTP/2 by default. This is
controlled via the `http.multiplexing` configuration variable and has
been messaged out for testing [1] (although got very few responses).
There's been surprisingly little fallout from parallel downloads, so
let's see how this goes!
bors [Fri, 9 Nov 2018 04:50:40 +0000 (04:50 +0000)]
Auto merge of #6285 - alexcrichton:more-timeouts, r=ehuss
Timeout batch downloads, not each download
This commit switches the timeout logic implemented in #6130 to timeout
an entire batch of downloads instead of each download individually.
Previously if *any* pending download didn't receive data in 30s we would
time out, or if *any* pending download didn't receive 10 bytes in 30s we
would time out. On very slow network connections this is highly likely
to happen as a trickle of incoming bytes may not be spread equally
amongst all connections, and not all connections may actually be active
at any one point in time.
The fix is to instead apply timeout logic for an entire batch of
downloads. Only if zero total data isn't received in the timeout window
do we time out. Or in other words, if any data for any download is
receive we consider it as not being timed out. Similarly any progress on
any download counts as progress towards our speed limit.
bors [Fri, 9 Nov 2018 03:33:57 +0000 (03:33 +0000)]
Auto merge of #6289 - ehuss:no-buffer-output, r=alexcrichton
Avoid retaining all rustc output in memory.
There are still a few cases where all output is buffered. They are:
- Running discovery commands like `rustc -vV`, `rustc --print xxx`, etc.
- Build script output.
- Testsuite's debug `.stream()` function.
This should cover the concern of the issue, though, which is normal compilation.
Alex Crichton [Thu, 8 Nov 2018 15:06:32 +0000 (07:06 -0800)]
Timeout batch downloads, not each download
This commit switches the timeout logic implemented in #6130 to timeout
an entire batch of downloads instead of each download individually.
Previously if *any* pending download didn't receive data in 30s we would
time out, or if *any* pending download didn't receive 10 bytes in 30s we
would time out. On very slow network connections this is highly likely
to happen as a trickle of incoming bytes may not be spread equally
amongst all connections, and not all connections may actually be active
at any one point in time.
The fix is to instead apply timeout logic for an entire batch of
downloads. Only if zero total data isn't received in the timeout window
do we time out. Or in other words, if any data for any download is
receive we consider it as not being timed out. Similarly any progress on
any download counts as progress towards our speed limit.
bors [Thu, 8 Nov 2018 01:10:19 +0000 (01:10 +0000)]
Auto merge of #6281 - ehuss:ci-progress, r=alexcrichton
Disable progress bar on CI.
Due to the recent change (#6233) to use ansi escape codes to clear the progress bar, Travis logs are looking quite odd. Generally you don't want the progress bar during CI builds anyways, so just disable it if "CI" is set, which most of the CI services do.
Alex Crichton [Tue, 6 Nov 2018 21:02:59 +0000 (13:02 -0800)]
Enable HTTP/2 by default
This commit switches Cargo to using HTTP/2 by default. This is
controlled via the `http.multiplexing` configuration variable and has
been messaged out for testing [1] (although got very few responses).
There's been surprisingly little fallout from parallel downloads, so
let's see how this goes!
bors [Wed, 7 Nov 2018 16:00:22 +0000 (16:00 +0000)]
Auto merge of #6274 - Eh2406:small_things, r=alexcrichton
Small things to help with fuzz tests
These are some small fixes to make it less likely to have randomly failing tests. This also documents what to do, and not to feel guilty, if the test do fail.
bors [Tue, 6 Nov 2018 02:33:27 +0000 (02:33 +0000)]
Auto merge of #6267 - ehuss:fix-fix_path_deps-again, r=alexcrichton
Fix fix_path_deps again.
The previous fix in #6236 wasn't enough to make this test not fail. On Travis MacOS it fails about 5% of the time. Essentially the first "FIXING" line is sometimes delayed until after the second "CHECKING" line. The "FIXING" message is sent async to the diagnostic server, so I think it's just a race that doesn't have a good way to enforce. Oddly, I can only repro this on Travis.
Error seen at:
https://travis-ci.org/rust-lang/cargo/jobs/450956693
bors [Tue, 6 Nov 2018 01:53:17 +0000 (01:53 +0000)]
Auto merge of #6130 - alexcrichton:less-timeouts-u, r=ehuss
Fix timeouts firing while tarballs are extracted
This commit fixes #6125 by ensuring that while we're extracting tarballs
or doing other synchronous work like grabbing file locks we're not
letting the timeout timers of each HTTP transfer keep ticking. This is
curl's default behavior (which we don't want in this scenario). Instead
the timeout logic is inlined directly and we manually account for the
synchronous work happening not counting towards timeout limits.
bors [Mon, 5 Nov 2018 17:33:14 +0000 (17:33 +0000)]
Auto merge of #6257 - khionu:master, r=alexcrichton
Configure tar to not set mtime
This PR is fixes #6238. Currently uses a `patch` on `tar`, and should not be merged until `tar` makes a release containing the function `set_preserve_mtime`.
bors [Mon, 5 Nov 2018 16:25:48 +0000 (16:25 +0000)]
Auto merge of #6260 - infinity0:master, r=alexcrichton
Fix package::include/exclude tests so they work even if running them not in cargo.git
Otherwise they fail due to mismatching error messages like here https://buildd.debian.org/status/fetch.php?pkg=cargo&arch=all&ver=0.31.0-1%7Eexp1&stamp=1541336261&raw=0 - we don't run `cargo test` from inside `cargo.git` but an unpacked tarball.
The test is brittle and only works if the surrounding crate is already inside a git repo but the test-case itself is not. This fixes that by putting the test case inside its own git repo.
bors [Sat, 3 Nov 2018 01:43:25 +0000 (01:43 +0000)]
Auto merge of #6249 - Eh2406:cleanup, r=alexcrichton
Resolver cleanups and a new fuzz test
This is the commits from my on going work on pub/priv deps that did not relate to that functionality. Then it also adds a fuzz test that minimal-versions does not change whether resolution is possible.
bors [Sat, 3 Nov 2018 00:16:39 +0000 (00:16 +0000)]
Auto merge of #6254 - ehuss:fix-travis-slow, r=alexcrichton
Fix slow MacOS Travis issue.
OS X 10.13 images on Travis are running very slow and causing timeouts. This PR does two things:
- Use OS X 10.12 (`xode9.2`) which is much faster.
- Implement a change to the testsuite to handle 1-second resolution mtimes on HFS. When a test executes cargo multiple times, and the first run finishes in under 1 second, the second one will think it needs to rebuild because the mtime of the files equals the mtime of the output. This change forces the mtime of every project to be created 1 second in the past. Tests that are still sensitive to mtimes are adjusted on a case-by-case basis.
bors [Fri, 2 Nov 2018 19:18:46 +0000 (19:18 +0000)]
Auto merge of #6252 - alexcrichton:clone-and-templtes, r=dwijnand
Never use templates when managing git repos
This commit disables usage of git templates whenever Cargo manages
repositories in its internal git database. Templates don't want to be
used at all in these situations and have been known to cause usability
bugs.
Alex Crichton [Fri, 2 Nov 2018 14:46:11 +0000 (07:46 -0700)]
Never use templates when managing git repos
This commit disables usage of git templates whenever Cargo manages
repositories in its internal git database. Templates don't want to be
used at all in these situations and have been known to cause usability
bugs.
bors [Thu, 1 Nov 2018 23:39:13 +0000 (23:39 +0000)]
Auto merge of #6247 - alexcrichton:fix-less, r=dwijnand
Don't turn on edition lints for unfixed crates
Currently Cargo runs the risk of turning on the edition lints for crates
which `cargo fix` isn't actually fixing, which means you'll get a huge
deluge of lints that would otherwise be automatically fixable! Fix this
situation by only enabling lints in the same cases that we're actually
applying fixes.
bors [Thu, 1 Nov 2018 22:36:33 +0000 (22:36 +0000)]
Auto merge of #6243 - btashton:strip_email_bracket, r=alexcrichton
Strip angle brackets from author email before passing to template.
Some people already have angle brackets around their email in
git settings or other author sources. Right now if you create
a new project the Cargo.toml would render something like:
`authors = ["bar <<foo@baz>>"]`
instead of
`authors = ["bar <foo@baz>"]`
This detects the emails that start and end with `<>` and removes them.
Brennan Ashton [Wed, 31 Oct 2018 20:07:02 +0000 (13:07 -0700)]
Strip angle brackets from author email before passing to template.
Some people already have angle brackets around their email in
git settings or other author sources. Right now if you create
a new project the Cargo.toml would render something like:
authors = ["bar <<foo@baz>>"]
instead of
authors = ["bar <foo@baz>"]
This detects the emails that start and end with <> and removes them.
Alex Crichton [Thu, 1 Nov 2018 15:13:11 +0000 (08:13 -0700)]
Don't turn on edition lints for unfixed crates
Currently Cargo runs the risk of turning on the edition lints for crates
which `cargo fix` isn't actually fixing, which means you'll get a huge
deluge of lints that would otherwise be automatically fixable! Fix this
situation by only enabling lints in the same cases that we're actually
applying fixes.