Behnam Esfahbod [Mon, 7 Aug 2017 16:31:32 +0000 (09:31 -0700)]
[cargo_new] Hint to use `cargo init` on existing dir
The `new` command always expects a non-existing path. The `init` command
always expects an existing path. Therefore, it makes sense to hint to
use `init` if the pre-condition to `new` is not satisfied.
bors [Mon, 7 Aug 2017 04:12:18 +0000 (04:12 +0000)]
Auto merge of #4372 - frankmcsherry:patch-1, r=alexcrichton
Modernize explanation of `build.rs`
After some recent head-banging, it was explained to me that `"build.rs"` is a special file name, and that Cargo will build such a file even if you do not expect it to, for example if `Cargo.toml` contains the commented out line
```
#build = "build.rs"
```
Some experimentation lead me to the described behavior, but if it misses any subtle details please feel free to correct. The old text is incorrect, though.
Frank McSherry [Sun, 6 Aug 2017 20:57:13 +0000 (16:57 -0400)]
Modernize explanation of `build.rs`
After some recent head-banging, it was explained to me that `"build.rs"` is a special file name, and that Cargo will build such a file even if you do not expect it to, for example if `Cargo.toml` contains the commented out line
```
#build = "build.rs"
```
Some experimentation lead me to the described behavior, but if it misses any subtle details please feel free to correct. The old text is incorrect, though.
bors [Fri, 4 Aug 2017 09:28:33 +0000 (09:28 +0000)]
Auto merge of #4355 - pornel:docs, r=alexcrichton
Expand profile settings descriptions
Flags were described in the format `foobar = true # controls foobar, passes '--foobar' flag`, but this doesn't actually say what `foobar` does. I've expanded the descriptions a little to provide more context.
Auto merge of #4342 - sid0:hgignore, r=alexcrichton
new: fix hgignore for real
There was an attempt to fix hgignore in #4158, but unfortunately the fix
was incorrect -- hgignore glob syntax is not in fact identical to
gitignore syntax.
To get rooted ignores in Mercurial we must use the regex-based syntax,
so we have no choice but to define a separate set of ignores.
There was an attempt to fix hgignore in #4158, but unfortunately the fix
was incorrect -- hgignore glob syntax is not in fact identical to
gitignore syntax.
To get rooted ignores in Mercurial we must use the regex-based syntax,
so we have no choice but to define a separate set of ignores.
Avoids the sticking point of the previous two PRs (multiple registry updates) by threading through a first-run boolean flag to decide whether `select_pkg` needs to call `source.update()`.
There is still the issue that flags such as `--git` and `--vers` are "global" to the multiple packages you may be installing. The workaround is just to run `cargo install` separately. In the future we could add syntax like `cargo install foo=1.0 bar=2.5 quux=git://github.com/durka/quux#dev-branch` or something.
Auto merge of #4335 - debris:rebased_4021, r=matklad
Rebased and fixed 4025: Apply --all if workspace is virtual
- fixes #4021
- rebased #4025
- fixed issue issue described by @matklad in https://github.com/rust-lang/cargo/pull/4025#pullrequestreview-40660570
- added test `build_virtual_manifest_one_project` which covers the fix
As discussed with @aturon, who took it to @rust-lang/core.
LICENSE-MIT and one source file contain inaccurate copyright notices of
the form "Copyright (c) (years) The Rust Project Developers", which
implies that an entity called "The Rust Project Developers" holds
copyrights in Rust. Rust contributors retain their copyrights, and do
not assign them to anyone by contributing. Remove the inaccurate
notices.
LICENSE-MIT and one source file contain inaccurate copyright notices of
the form "Copyright (c) (years) The Rust Project Developers", which
implies that an entity called "The Rust Project Developers" holds
copyrights in Rust. Rust contributors retain their copyrights, and do
not assign them to anyone by contributing. Remove the inaccurate
notices.
[doc/manifest] Add build-dependencies to Dependency sections list
The `[build-dependencies]` section was missing from the Dependency
sections list, making it hard to find its existence and link to
`specifying-dependencies` page. This puts the section title in the list,
so a normal find works.
[doc/manifest] Add build-dependencies to Dependency sections list
The `[build-dependencies]` section was missing from the Dependency
sections list, making it hard to find its existence and link to
`specifying-dependencies` page. This puts the section title in the list,
so a normal find works.
Auto merge of #4305 - nodakai:fix-4278-tests-on-empty-ld_library_path, r=matklad
tests/build.rs: remove empty components from LD_LIBRARY_PATH to fix #4278
The tests intended to ensure Cargo wouldn't mistakenly add empty components to `LD_LIBRARY_PATH` (or its equivalents) but they could fail when the test runner already had empty components in `LD_LIBRARY_PATH` from their environment.
NODA, Kai [Wed, 19 Jul 2017 13:59:50 +0000 (21:59 +0800)]
tests/build.rs: remove empty components from LD_LIBRARY_PATH
This is to amend PR #4278
The tests intended to ensure Cargo wouldn't mistakenly add empty
components to LD_LIBRARY_PATH (or its equivalents) but they could fail
when the test runner already had empty components in LD_LIBRARY_PATH
from their environment.
Auto merge of #4303 - bluetech:doc-env-cfg, r=alexcrichton
Document the CARGO_CFG_* environment variables - fixes #4302
In order to keep the paragraph brief, I have omitted:
- examples of actual variable names - though adding those might help google.
- mention of `rustc --print cfg` - I think the link to the reference is enough.
- reference to the [RFC](https://github.com/rust-lang/rfcs/blob/master/text/1721-crt-static.md#lowering-cfg-values-to-cargo-build-script-environment-variables) - I don't think it's needed.
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