This pulls out the definitions of these functions into a single crate, [home](https://github.com/brson/home), to act as their canonical definition.
This has a bigger impact on rustup, since it is using definitions of all these things, where cargo is just defining cargo_home in terms of std's wrong home_dir.
The [definition of cargo_home](https://github.com/brson/home/blob/master/src/lib.rs#L179) used here is slightly different than what cargo has today in that it contains a bit of defensive code to avoid allowing `CARGO_HOME` to be set to `.multirust/cargo` - this is backwards compatibility code from rustup.
Auto merge of #4123 - alexcrichton:augment, r=matklad
Implement the [patch] section of the manifest
This is an implementation of [RFC 1969] which adds a new section to top-level
manifests: `[patch]`. This section allows you to augment existing sources with
new versions of crates, possibly replacing the versions that already exist in
the source. More details about this feature can be found in the RFC itself.
Alex Crichton [Fri, 12 May 2017 18:07:46 +0000 (11:07 -0700)]
Implement the [patch] section of the manifest
This is an implementation of [RFC 1969] which adds a new section to top-level
manifests: `[patch]`. This section allows you to patch existing sources with
new versions of crates, possibly replacing the versions that already exist in
the source. More details about this feature can be found in the RFC itself.
Auto merge of #4270 - behnam:ignore, r=alexcrichton
[sources/path] Add gitignore-like pattern matching and warn on mismatches
Add gitignore-like pattern matching logic to `list_files()` and throw
warnings for paths getting different inclusion/exclusion results from
the old and the new methods.
Auto merge of #4292 - xftroxgpx:unconfuse_bin_name, r=matklad
quote the binary name in the warning
to avoid confusion when the warning happens inside a workspace, example:
pwd is rustlearnage/rust_books/1_first_edition/closures/
and `cargo run` shows:
```
warning: path `src/main.rs` was erroneously implicitly accepted for binary match,
please set bin.path in Cargo.toml
```
(note that 'match' is not quoted, so it's confusing)
the 'match' project that it's referring to is in rustlearnage/rust_books/1_first_edition/match/
(note: Cargo.toml [workspace] is in rustlearnage/ )
to avoid confusion when the warning happens inside a workspace, example:
pwd is rustlearnage/rust_books/1_first_edition/closures/
and `cargo run` shows:
warning: path `src/main.rs` was erroneously implicitly accepted for binary match,
please set bin.path in Cargo.toml
(note that 'match' is not quoted, so it's confusing)
the 'match' project that it's referring to is in rustlearnage/rust_books/1_first_edition/match/
(note: Cargo.toml [workspace] is in rustlearnage/ )
[sources/path] Add gitignore-like pattern matching and warn on mismatches
Add gitignore-like pattern matching logic to `list_files()` and throw
warnings for paths getting different inclusion/exclusion results from
the old and the new methods.
Auto merge of #4259 - matklad:conventions, r=alexcrichton
Conventions
r? @alexcrichton
I'd love to refactor our handing of inferring targets by convention, because it is super difficult to understand, and quite probably contains a couple of unintended/undocumented conventions (like `src/foo.rs` being a binary `foo` if there's no library in the package).
As a first step, I've just moved all the logic (600 loc) to a separate file from the `toml.rs` file, which used to be just **huge** (we even use in in IntelliJ Rust for performance testing :) ), and now it is "only" just above 1kloc :)
Auto merge of #4267 - natboehm:add-index-flag-search, r=matklad
Replace `cargo search --host` with `cargo search --index`
This change makes the command consistent with other versions of the same flag. `cargo search --host` is still supported, as well as `cargo search --index <index> --host <host>` in case of confusion. The three commands currently supported should produce the same behavior. All instances of `--host` are currently marked as deprecated, or for reuse as mentioned in issue #4208.
Modified tests to use '--index' instead of '--host', added test to support using '--host' with warning message, added test to support using both '--host' and '--index' with warning message for host
bors [Fri, 30 Jun 2017 05:49:34 +0000 (05:49 +0000)]
Auto merge of #4239 - Keruspe:master, r=alexcrichton
hash '__CARGO_DEFAULT_LIB_METADATA' in metadata for rustc
We already have __CARGO_DEFAULT_LIB_METADATA to force adding the hash of some metadata in the libraries file name when building rust.
For now, we only check if it is set or not.
This patch makes also use of its value to compute the hash. This way we'll be able to pass in the channel we're building to avoid hash collisions between channels.
bors [Thu, 29 Jun 2017 01:01:27 +0000 (01:01 +0000)]
Auto merge of #4234 - michaelwoerister:smarter-cargo-incremental-2, r=alexcrichton
Set -Ccodegen-units=N for non-path dependencies when CARGO_INCREMENTAL is set.
This PR tweaks compilation for non-path dependencies when CARGO_INCREMENTAL is set. Before, `cargo` would compile such dependencies "just" non-incrementally while, with this PR, it will also set the number of CGUs to the number of CPU cores. Otherwise compiling those dependencies might take significantly longer (because of more expensive optimizations and less multi-threading) than compiling them incrementally -- which is what we wanted to avoid in the first place.
bors [Wed, 28 Jun 2017 06:39:50 +0000 (06:39 +0000)]
Auto merge of #4229 - azerupi:install-version-range, r=matklad
Implement semver ranges for install --vers
This implements the design discussed in #4207
It allows to specify semver ranges on `cargo install ... --vers`
1. The first character of the `--vers` value is checked, if there is none we return an error.
2. If it is one of `<`, `>`, `=`, `^`, `~` we parse the value as a `VersionReq`, otherwise we parse it as a `Version`.
3. If the parsing as a `Version` fails but parsing as `VersionReq` succeeds, we add a note to the warning mentioning that a qualifier should be used to specify a semver range. This catches versions with less than tree digits.
Otherwise, the previous behaviour is preserved with the warning of backwards compatibility.
This means that
- `cargo install ... --vers "^1.2.3"` will be parsed as a range
- `cargo install ... --vers 1.2.3` will be parsed as a version
- `cargo install ... --vers 1.2` will be parsed as a version for backwards compatibility reasons, fail and be passed through as is,**but** we will add a note `if you want to specify semver range, add an explicit qualifier, like ^1.2`
- `cargo install ... --vers blah` will be parsed as a version for backwards compatibility reasons (which is weird because it is not even a valid semver range) and produce an `unknown error` down the line. I have left this behaviour untouched because it worked like that before, but I can easily make it error sooner with a better message.
bors [Tue, 27 Jun 2017 00:42:29 +0000 (00:42 +0000)]
Auto merge of #4230 - Mark-Simulacrum:double-print, r=alexcrichton
Prevent rustc stderr/stdout from being duplicated.
Please review carefully. I've not submitted patches to Cargo before, I think, so this may be flawed in some way I haven't detected yet. Tests are green locally, though.