bors [Mon, 22 Jan 2018 15:33:14 +0000 (15:33 +0000)]
Auto merge of #4968 - edunham:patch-1, r=alexcrichton
Link to crate type docs
This page (served at https://doc.rust-lang.org/cargo/reference/manifest.html) is the first hit I get when searching "cargo crate-type". The doc which actually explains `crate-type`, https://doc.rust-lang.org/reference/linkage.html, does not appear in the first page of results. I hope that linking the reference doc here will make it easier for others to find instead of having to dig into closed GitHub issues like I did to find it.
E. Dunham [Mon, 22 Jan 2018 05:39:27 +0000 (21:39 -0800)]
Link to crate type docs
This page (served at https://doc.rust-lang.org/cargo/reference/manifest.html) is the first hit I get when searching "cargo crate-type". The doc which actually explains `crate-type`, https://doc.rust-lang.org/reference/linkage.html, does not appear in the first page of results. I hope that linking the reference doc here will make it easier for others to find instead of having to dig into closed GitHub issues like I did to find it.
Ted Mielczarek [Thu, 18 Jan 2018 19:51:40 +0000 (14:51 -0500)]
Add a missing link in the book for `jobserver`. I don't know what the original
intended link destination was, so I chose to link to the GNU Make documentation.
bors [Wed, 17 Jan 2018 16:22:07 +0000 (16:22 +0000)]
Auto merge of #4950 - alexcrichton:rustflags-orderd, r=matklad
Ensure `[target]` rustflags are deterministically passed
The usage of `HashMap` in the `Config` tables introduced some nondeterminism, so
reverse that with a sort right before we pass it down to rustc. One day we'll
probably want to sort by the position where these keys were defined, but for now
a blanket sort should do the trick.
bors [Wed, 17 Jan 2018 15:39:58 +0000 (15:39 +0000)]
Auto merge of #4949 - alexcrichton:fix-patch-network, r=matklad
Fix `[patch]` sections depending on one another
This commit fixes a bug in `[patch]` where the original source is updated too
often (for example `Updating ...` being printed too much). This bug occurred
when patches depended on each other (for example the dependencies of a resolved
`[patch]` would actually resolve to a `[patch]` that hadn't been resolved yet).
The ordering of resolution/locking wasn't happening correctly and wasn't ready
to break these cycles!
The process of adding `[patch]` sections to a registry has been updated to
account for this bug. Instead of add-and-lock all in one go this commit instead
splits the addition of `[patch]` into two phases. In the first we collect a
bunch of unlocked patch summaries but record all the `PackageId` instances for
each url we've scraped. After all `[patch]` sections have been processed in this
manner we go back and lock all the summaries that were previously unlocked. The
`lock` function was updated to *only* need the map of patches from URL to
`PackageId` as it doesn't actually have access to the full `Summary` of patches
during the `lock_patches` method.
All in all this should correctly resolve dependencies here which means that
processing of patches should proceed as usual, avoiding updating the registry
too much!
Alex Crichton [Tue, 16 Jan 2018 19:22:40 +0000 (11:22 -0800)]
Ensure `[target]` rustflags are deterministically passed
The usage of `HashMap` in the `Config` tables introduced some nondeterminism, so
reverse that with a sort right before we pass it down to rustc. One day we'll
probably want to sort by the position where these keys were defined, but for now
a blanket sort should do the trick.
Alex Crichton [Tue, 16 Jan 2018 15:33:59 +0000 (07:33 -0800)]
Fix `[patch]` sections depending on one another
This commit fixes a bug in `[patch]` where the original source is updated too
often (for example `Updating ...` being printed too much). This bug occurred
when patches depended on each other (for example the dependencies of a resolved
`[patch]` would actually resolve to a `[patch]` that hadn't been resolved yet).
The ordering of resolution/locking wasn't happening correctly and wasn't ready
to break these cycles!
The process of adding `[patch]` sections to a registry has been updated to
account for this bug. Instead of add-and-lock all in one go this commit instead
splits the addition of `[patch]` into two phases. In the first we collect a
bunch of unlocked patch summaries but record all the `PackageId` instances for
each url we've scraped. After all `[patch]` sections have been processed in this
manner we go back and lock all the summaries that were previously unlocked. The
`lock` function was updated to *only* need the map of patches from URL to
`PackageId` as it doesn't actually have access to the full `Summary` of patches
during the `lock_patches` method.
All in all this should correctly resolve dependencies here which means that
processing of patches should proceed as usual, avoiding updating the registry
too much!
bors [Tue, 16 Jan 2018 06:11:46 +0000 (06:11 +0000)]
Auto merge of #4944 - mathstuf:better-gitignore-template, r=alexcrichton
cargo_new: drop the trailing slash for target exclusion in Git
When `target` is a symlink (e.g., to keep build outputs on a separate
partition), Git will not match the `/target/` ignore to the symlink
since it is not a directory. Drop the trailing slash to support ignoring
`target` as a symlink.
Ben Boeckel [Mon, 15 Jan 2018 22:07:56 +0000 (17:07 -0500)]
cargo_new: drop the trailing slash for target exclusion in Git
When `target` is a symlink (e.g., to keep build outputs on a separate
partition), Git will not match the `/target/` ignore to the symlink
since it is not a directory. Drop the trailing slash to support ignoring
`target` as a symlink.
bors [Sat, 13 Jan 2018 23:59:50 +0000 (23:59 +0000)]
Auto merge of #4938 - ehuss:ws-meta, r=alexcrichton
Add workspace root to metadata command.
Fixes #4933
@alexcrichton, you mentioned using `"workspace_manifest"`, but the `Workspace.root` function already strips off `Cargo.toml`. It would be easy to append it back, though I'm uncertain if that's really necessary since I think for most use cases it will just need to be stripped off again. Also, I feel like it might be confusing for non-workspace packages since `workspace_manifest` would be the same as the package `manifest_path` (and in that case it isn't really a workspace manifest). I can easily change it, just let me know.
bors [Thu, 11 Jan 2018 09:18:22 +0000 (09:18 +0000)]
Auto merge of #4931 - Manishearth:testname, r=matklad
Explicitly mention testname argument for cargo test/bench
The fact that `cargo test foo` works is totally non obvious. I suspect that 99% of the time
folks running `cargo help test` are looking for a way to only run a specific test, and
the current help message makes it seem like the way to do that is `cargo test --test foo`,
which is incorrect (it runs a specific test target).
This PR mentions it explicitly in the help message, first and foremost.
bors [Tue, 9 Jan 2018 03:27:46 +0000 (03:27 +0000)]
Auto merge of #4923 - wking:console-markup, r=alexcrichton
doc: Replace 'shell' language labels (generally with 'console')
#GitHub [uses Linguist][1] for syntax highlighting. Linguist's [`shell` language][2] is for the *language* (e.g. the contents of a `.sh` file). The proper language for a shell session is [`ShellSession`][3], although in this commit I've used the [alias `console`][4].
The Cargo book [uses mdBook][4.5], mdBook [uses Highlight.js][5], and Highlight.js [also supports `console` as an alias for shell sessions][6].
A handful of places where we had been using `shell` were just command output, not shell sessions (e.g. they lacked a prompt and command). In this commit, I've left those without a language label.
bors [Tue, 9 Jan 2018 02:27:48 +0000 (02:27 +0000)]
Auto merge of #4921 - wking:doc/guide-rust, r=alexcrichton
doc/guide/dependencies: Add a 'rust' language marker
This had been added to the non-book docs in 2ad45a56 (#4455), despite the fact that the book didn't actually have that marker:
$ git cat-file -p 2ad45a56:src/doc/book/src/guide/dependencies.md | grep -A2 'You can now use the'
You can now use the `regex` library using `extern crate` in `main.rs`.
```
This is (along with the already-landed #4916), part of recovering from #4904.
bors [Tue, 9 Jan 2018 01:26:46 +0000 (01:26 +0000)]
Auto merge of #4839 - sfackler:consistent-config, r=withoutboats
Make .cargo/credentials a subset of .cargo/config
Previously, .cargo/credentials looked like
```toml
token = "..."
[my-registry]
token = "..."
```
And was simply merged into the `registry` block of .cargo/config. This
meant that custom registry tokens were under
`registry.my-registry.token` rather than `registries.my-registry.token`
which is where the index was located, and that you couldn't have a
custom registry named `token` or it'd conflict with the token for the
default registry.
This commit changes things such that .cargo/credentials has the same
layout as .cargo/config, but only contains token values. For backwards
compatibility, we move `token` to `registry.token` when parsing.
Steven Fackler [Wed, 20 Dec 2017 03:37:14 +0000 (19:37 -0800)]
Make .cargo/credentials a subset of .cargo/config
Previously, .cargo/credentials looked like
```toml
token = "..."
[my-registry]
token = "..."
```
And was simply merged into the `registry` block of .cargo/config. This
meant that custom registry tokens were under
`registry.my-registry.token` rather than `registries.my-registry.token`
which is where the index was located, and that you couldn't have a
custom registry named `token` or it'd conflict with the token for the
default registry.
This commit changes things such that .cargo/credentials has the same
layout as .cargo/config, but only contains token values. For backwards
compatibility, we move `token` to `registry.token` when parsing.
W. Trevor King [Mon, 8 Jan 2018 22:42:48 +0000 (14:42 -0800)]
doc: Replace 'shell' language labels (generally with 'console')
GitHub uses Linguist for syntax highlighting [1]. Linguist's 'shell'
language is for the *language* [2] (e.g. the contents of a `.sh`
file). The proper language for a shell session is ShellSession [3],
although in this commit I've used the alias 'console' [4].
The Cargo book uses mdBook (src/doc/README.md), mdBook uses
Highlight.js [5], and Highlight.js also supports 'console' as an alias
for shell sessions [6].
A handful of places where we had been using 'shell' were just command
output, not shell sessions (e.g. they lacked a prompt and command).
In this commit, I've left those without a language label.
bors [Mon, 8 Jan 2018 22:31:25 +0000 (22:31 +0000)]
Auto merge of #4922 - wking:reference-wording-from-guide-trailer, r=alexcrichton
doc/reference/index: Remove "Now that you have an overview" paragraph
This wording was originally from 58a1804f (#2688), which added it to the end of the guide (where telling readers what they know makes some sense). It was moved to a "Cargo in Depth" section with 01aa9e3c (#4453), where it makes a bit less sense. When that section became the reference index in 3f2d93e3 (#4455) the context assumed by the paragraph was completely missing.
This commit removes the paragraph, which doesn't reduce the usefulness of the reference index. And the removal avoids confusing readers who start with the reference docs and may now have the assumed overview.
W. Trevor King [Mon, 8 Jan 2018 22:06:55 +0000 (14:06 -0800)]
doc/reference/index: Remove "Now that you have an overview" paragraph
This wording was originally from 58a1804f (At the end, point to docs
that might be interesting next, 2016-05-17, #2688), which added it to
the end of the guide (where telling readers what they know makes some
sense). It was moved to a "Cargo in Depth" section with 01aa9e3c
([src/doc/book] Move a paragraph to cargo-in-depth.md, 2017-08-31,
#4453), where it makes a bit less sense. When that section became the
reference index in 3f2d93e3 ([doc/book] Create dir for book sections,
2017-08-31, #4455) the context assumed by the paragraph was completely
missing.
This commit removes the paragraph, which doesn't reduce the usefulness
of the reference index. And the removal avoids confusing readers who
start with the reference docs and may now have the assumed overview.
W. Trevor King [Mon, 8 Jan 2018 21:56:54 +0000 (13:56 -0800)]
doc/guide/dependencies: Add a 'rust' language marker
This had been added to the non-book docs in 2ad45a56 ([doc] Sync back
doc/book changes into old docs, 2017-08-31, #4455), despite the fact
that the book didn't actually have that marker:
$ git cat-file -p 2ad45a56:src/doc/book/src/guide/dependencies.md | grep -A2 'You can now use the'
You can now use the `regex` library using `extern crate` in `main.rs`.
W. Trevor King [Mon, 8 Jan 2018 18:39:13 +0000 (10:39 -0800)]
Cargo.toml: Replace '/' with 'OR' in 'license'
Catch up with our recommendations from 7dee65fe (src/doc/manifest: Pin
'license' to SPDX 2.1 expressions and the 2.4 list, 2018-01-04,
#4898), which deprecated '/' in favor of vanilla SPDX license
expressions.
I've gone with the disjunctive OR, because the README has:
> Cargo is primarily distributed under the terms of both the MIT
> license and the Apache License (Version 2.0).
bors [Mon, 8 Jan 2018 18:04:53 +0000 (18:04 +0000)]
Auto merge of #4919 - alexcrichton:faster-git-clone, r=matklad
Leverage local links on git checkouts
This commit updates the handling of git checkouts from the database to use
hardlinks if possible, speeding up this operation for large repositories
significantly.
As a refresher, Cargo caches git repositories in a few locations to speed up
local usage of git repositories. Cargo has a "database" folder which is a bare
checkout of any git repository Cargo has cached historically. This database
folder contains effectively a bunch of databases for remote repos that are
updated periodically.
When actually building a crate Cargo will clone this database into a different
location, the checkouts folder. Each rev we build (ever) is cached in the
checkouts folder. This means that once a checkout directory is created it's
frozen for all of time.
This latter step is what this commit is optimizing. When checking out the
database onto the local filesystem at a particular revision. Previously we were
instructing libgit2 to fall back to a "git aware" transport which was
exceedingly slow on some systems for filesystem-to-filesystem transfers. This
optimization (we just forgot to turn it on in libgit2) is a longstanding one and
should speed this up significantly!
Alex Crichton [Mon, 8 Jan 2018 17:38:40 +0000 (09:38 -0800)]
Leverage local links on git checkouts
This commit updates the handling of git checkouts from the database to use
hardlinks if possible, speeding up this operation for large repositories
significantly.
As a refresher, Cargo caches git repositories in a few locations to speed up
local usage of git repositories. Cargo has a "database" folder which is a bare
checkout of any git repository Cargo has cached historically. This database
folder contains effectively a bunch of databases for remote repos that are
updated periodically.
When actually building a crate Cargo will clone this database into a different
location, the checkouts folder. Each rev we build (ever) is cached in the
checkouts folder. This means that once a checkout directory is created it's
frozen for all of time.
This latter step is what this commit is optimizing. When checking out the
database onto the local filesystem at a particular revision. Previously we were
instructing libgit2 to fall back to a "git aware" transport which was
exceedingly slow on some systems for filesystem-to-filesystem transfers. This
optimization (we just forgot to turn it on in libgit2) is a longstanding one and
should speed this up significantly!
bors [Sat, 6 Jan 2018 18:10:30 +0000 (18:10 +0000)]
Auto merge of #4909 - zackmdavis:tidy_paren, r=matklad
unblock rust-lang/rust#46980 by cleaning up an unused pair of parentheses
While this might seem like too trivial of a stylistic nitpick to deserve
its own commit, this [is needed to unblock](https://github.com/rust-lang/rust/pull/46980#issuecomment-355565906) the PR rust-lang/rust#46980 (which makes
the unused-parens lint look at function arguments, which it previously didn't).
Zack M. Davis [Sat, 6 Jan 2018 17:58:05 +0000 (09:58 -0800)]
clean up an unused pair of parentheses
While this might seem like too trivial of a stylistic nitpick to deserve
its own commit, this is needed to unblock rust-lang/rust#46980 (which makes
the unused-parens lint look at function arguments).
bors [Fri, 5 Jan 2018 19:11:56 +0000 (19:11 +0000)]
Auto merge of #4904 - alexcrichton:clean-docs, r=alexcrichton
Delete the old docs, lift up the new
This commit deletes the old documentation now that the "official source" is the
main book. The book is now lifted up directly into `src/doc` instead of
`src/doc/book`.
The CI no longer builds documentation and has been updated to just run mdbook to
make sure there's no errors. The documentation will actually get published in
the rust-lang/rust repo
Alex Crichton [Fri, 5 Jan 2018 19:08:58 +0000 (11:08 -0800)]
Delete the old docs, lift up the new
This commit deletes the old documentation now that the "official source" is the
main book. The book is now lifted up directly into `src/doc` instead of
`src/doc/book`.
The CI no longer builds documentation and has been updated to just run mdbook to
make sure there's no errors. The documentation will actually get published in
the rust-lang/rust repo
bors [Thu, 4 Jan 2018 21:16:36 +0000 (21:16 +0000)]
Auto merge of #4898 - wking:license-pin-spdx, r=alexcrichton
src/doc/manifest: Pin 'license' to SPDX 2.1 expressions and the 2.4 list
Before this commit, the license-list URL was floating, which lead to issues when manifest authors used IDs from the list that had not yet made it into crate.io's whitelist (#4888). This commit pins both the SPDX-spec version (to avoid floating the license-expresion syntax) and the license-list version (to avoid floating the license/exception identifiers).
I've also deprecated the `/` syntax, since it was not clear whether that was conjunctive (like `AND`) or disjunctive (like `OR`). crates.io is [using license-exprs 1.3^][2], and [that version supports `WITH`, `AND`, `OR`, and the `+` suffix][3], so as far as crates.io-validation is concerned, the value can use vanilla license expressions.
It's unfortunate that there's not an easily-browsable version of the 2.4 license list up anywhere canonical (as far as I know). Starting with the 3.0 license list, there's [a Markdown page in the authoritative list-data repository][4]. I can also see about getting [earlier versions of the HTML][5] up on spdx.org somewhere.
I'm expecting the version-bump procedure will look something like:
1. SPDX cuts a new spec and/or license list release.
2. license-exprs updates to cover the change.
3. crates.io updates to depend on the new license-exprs version.
4. cargo updates the documentation to allow the new version.
5. authors read the new cargo docs and start using the new expression syntax and/or identifiers.
There's a window there where crates.io will be validating to a different version than the cargo docs recommend, so it would be good to have 4 follow 3 as closely as possible. But the SPDX maintainers have been good about providing long deprecation windows, so a bit of a gap is acceptable.
It's possible that crates.io will want to warn authors about their use of deprecated identifiers or syntax (e.g. the `/` I've deprecated here) so they can upgrade before the deprecated element is dropped (probably years after the initial deprecation). That would help limit the gap between 3 and 5 (although warnings sent before 4 might be confusing).
The parallel edits to the two manifest files are based on @carols10cents' recommendation. She [points out on IRC][6] that the goal is to drop the `src/doc/manifest.md` reference soon with the book up on `doc.rust-lang.org/cargo` today.
Fixes #4888, although it would be good to start the upgrade cycle to pull in the [newly-released SPDX license list 3.0][7] so folks can start using the new identifiers.
W. Trevor King [Thu, 4 Jan 2018 18:47:16 +0000 (10:47 -0800)]
src/doc/manifest: Pin 'license' to SPDX 2.1 expressions and the 2.4 list
Before this commit, the license-list URL was floating, which lead to
issues when manifest authors used IDs from the list that had not yet
made it into crate.io's whitelist [1]. This commit pins both the
SPDX-spec version (to avoid floating the license-expresion syntax) and
the license-list version (to avoid floating the license/exception
identifiers).
I've also deprecated the / syntax, since it was not clear whether that
was conjunctive (like AND) or disjunctive (like OR). crates.io is
using license-exprs 1.3^ [2], and that version supports WITH, AND, OR,
and the + suffix [3], so as far as crates.io-validation is concerned,
the value can use vanilla license expressions.
It's unfortunate that there's not an easily-browsable version of the
2.4 license list up anywhere canonical (as far as I know). Starting
with the 3.0 license list, there's a Markdown page in the
authoritative list-data repository [4]. I can also see about getting
earlier versions of the HTML (e.g. [5]) up on spdx.org somewhere.
I'm expecting the version-bump procedure will look something like:
1. SPDX cuts a new spec and/or license list release.
2. license-exprs updates to cover the change.
3. crates.io updates to depend on the new license-exprs version.
4. cargo updates the documentation to allow the new version.
5. authors read the new cargo docs and start using the new expression
syntax and/or identifiers.
There's a window there where crates.io will be validating to a
different version than the cargo docs recommend, so it would be good
to have 4 follow 3 as closely as possible. But the SPDX maintainers
have been good about providing long deprecation windows, so a bit of a
gap is acceptable.
It's possible that crates.io will want to warn authors about their use
of deprecated identifiers or syntax (e.g. the '/' I've deprecated
here) so they can upgrade before the deprecated element is dropped
(probably years after the initial deprecation). That would help limit
the gap between 3 and 5 (although warnings sent before 4 might be
confusing).
The parallel edits to the two manifest files are based on Carol
Nichols' recommendation. She points out on IRC that the goal is to
drop the src/doc/manifest.md reference soon with the book up on
doc.rust-lang.org/cargo today [6].