]> git.proxmox.com Git - cargo.git/log
cargo.git
6 years agoUpdating based on code review
Pelepeichenko Alexander [Mon, 8 Jan 2018 18:22:12 +0000 (20:22 +0200)]
Updating based on code review

6 years agoadd offline mode (-Z offline) with tests
Pelepeichenko Alexander [Sun, 24 Dec 2017 23:32:29 +0000 (01:32 +0200)]
add offline mode (-Z offline) with tests

6 years agoAuto merge of #4919 - alexcrichton:faster-git-clone, r=matklad
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!

Closes #4604

6 years agoLeverage local links on git checkouts
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!

Closes #4604

6 years agoAuto merge of #4916 - tari:doc-recovery, r=alexcrichton
bors [Mon, 8 Jan 2018 16:37:05 +0000 (16:37 +0000)]
Auto merge of #4916 - tari:doc-recovery, r=alexcrichton

Recover doc changes lost in #4904

Fixes #4906.

6 years agoAuto merge of #4914 - xftroxgpx:doc_profile_section_in_workspace_only, r=alexcrichton
bors [Mon, 8 Jan 2018 15:49:18 +0000 (15:49 +0000)]
Auto merge of #4914 - xftroxgpx:doc_profile_section_in_workspace_only, r=alexcrichton

doc: [profile.*] sections are for root crate only

ie.
warning: profiles for the non root package will be ignored, specify profiles at the workspace root

rendered:
![untitled2](https://user-images.githubusercontent.com/26243389/34655211-38d7ad18-f406-11e7-9857-76046aa14dea.png)

6 years agoAuto merge of #4915 - xftroxgpx:typo2, r=alexcrichton
bors [Mon, 8 Jan 2018 15:08:56 +0000 (15:08 +0000)]
Auto merge of #4915 - xftroxgpx:typo2, r=alexcrichton

doc: typo "worksapce" -> "workspace"

occurs twice

6 years agoRecover caveat about -vv and cleaning
Peter Marheine [Mon, 8 Jan 2018 05:31:45 +0000 (16:31 +1100)]
Recover caveat about -vv and cleaning

First added in 72c924230c3df67261642f74ba415cb34086935f which failed
to update the book and was replaced in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRecover non-virtual default-members doc
Peter Marheine [Mon, 8 Jan 2018 05:29:07 +0000 (16:29 +1100)]
Recover non-virtual default-members doc

First changed in f9a27fc1f7ef0e4360c878a0209370a86b310b5e which failed
to update the book and was replaced in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRecover docs for workspace.default-members
Peter Marheine [Mon, 8 Jan 2018 05:26:19 +0000 (16:26 +1100)]
Recover docs for workspace.default-members

First added in 82d563b71bf697f3d989cc1fdc2455c59679c309 which failed
to update the book and was replaced in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRecover implied --all for virtual workspace docs
Peter Marheine [Mon, 8 Jan 2018 05:24:23 +0000 (16:24 +1100)]
Recover implied --all for virtual workspace docs

First changed in 1240f42c899fbba8bf85e493c3beb9f82227a09a which failed
to update the book and was replaced in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRecover 'Add missing spaces around = sign'
Peter Marheine [Mon, 8 Jan 2018 05:22:15 +0000 (16:22 +1100)]
Recover 'Add missing spaces around = sign'

First changed in e8a1ba6f63a93430b1de6fc772e3f950d5bd63f2 which failed
to update the book and was replaced in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRecover [patch] doc clarifications
Peter Marheine [Mon, 8 Jan 2018 05:21:09 +0000 (16:21 +1100)]
Recover [patch] doc clarifications

First added in 1700346a9e9fe36b6e5b6858fc9a03d63f4fa37e which failed
to update the book and was replaced in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRecover gcc -> cc in build docs
Peter Marheine [Mon, 8 Jan 2018 05:17:15 +0000 (16:17 +1100)]
Recover gcc -> cc in build docs

First changed in 209513d8991e05049c1e78c6cdf14c0865f2dd16 which failed
to update the book and was replaced in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRecover spelling correction for 'otherwsie'
Peter Marheine [Mon, 8 Jan 2018 05:14:54 +0000 (16:14 +1100)]
Recover spelling correction for 'otherwsie'

First fixed in 7b65667d5912e46ab2a39a7914a0ade869acc258 which failed
to update the book and was replaced in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRecover discussion of -vv for build output
Peter Marheine [Mon, 8 Jan 2018 05:13:34 +0000 (16:13 +1100)]
Recover discussion of -vv for build output

First added in 723945cb0eae7d642caa88812c6ecee3ed5895a1 which failed
to update the book and was replaced in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRe-fix spelling of 'workspace'
Peter Marheine [Mon, 8 Jan 2018 05:11:26 +0000 (16:11 +1100)]
Re-fix spelling of 'workspace'

First fixed in 4848c30414c6ed6b7afbe6067703ccfe0510d0ec which failed
to update the book and was replaced in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRecover doc for appveyor project_name
Peter Marheine [Mon, 8 Jan 2018 05:10:09 +0000 (16:10 +1100)]
Recover doc for appveyor project_name

First added in 53012bd4df83a0d43ce7dfd0175d78b084823477 which failed
to update the book and was replaced in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRecover typo fix from 95fa8fe027ba080f5f5cb336c8a7d31d046bbf4b
Peter Marheine [Mon, 8 Jan 2018 05:07:25 +0000 (16:07 +1100)]
Recover typo fix from 95fa8fe027ba080f5f5cb336c8a7d31d046bbf4b

Lost in 1271bb4de0c0e0a085be239c2418af9c673ffc87

6 years agoRecover doc for inferred directory targets
Peter Marheine [Mon, 8 Jan 2018 05:02:46 +0000 (16:02 +1100)]
Recover doc for inferred directory targets

First created in 6b94ed2238a3f378cfe4fda47922cef0908a942c and lost by
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRecover workspace member clarification from 8139a5d830d2c59b76abd9865ae7aeffdaaa107f
Peter Marheine [Mon, 8 Jan 2018 04:59:59 +0000 (15:59 +1100)]
Recover workspace member clarification from 8139a5d830d2c59b76abd9865ae7aeffdaaa107f

The original failed to update the book and was lost in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRecover doc for appveyor project ID
Peter Marheine [Mon, 8 Jan 2018 04:57:56 +0000 (15:57 +1100)]
Recover doc for appveyor project ID

Cherry-picked from f59eb30bbb9f1c30dcbfebe54aed72e1f51ba7cc which failed
to update the book and was replaced in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRecover doc mention of sccache
Peter Marheine [Mon, 8 Jan 2018 04:54:18 +0000 (15:54 +1100)]
Recover doc mention of sccache

Cherry-picked from 13bb7bd95b457f7383487cf8dcf476009939cfac which failed
to update the book and was replaced in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRecover docs for git vendoring
Peter Marheine [Mon, 8 Jan 2018 04:46:55 +0000 (15:46 +1100)]
Recover docs for git vendoring

Cherry-picked from 5b08b8fe1019147fe489db17a9a8ae7ebe97f9e9 which failed
to update the book and was replaced in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agoRecover docs for incremental compilation
Peter Marheine [Mon, 8 Jan 2018 04:35:28 +0000 (15:35 +1100)]
Recover docs for incremental compilation

Cherry-picked from 45cc30bc7379ae13b079157b660de9d084de7a9e which failed
to update the book and was replaced in
1271bb4de0c0e0a085be239c2418af9c673ffc87.

6 years agodoc: typo "worksapce" -> "workspace"
xftroxgpx [Mon, 8 Jan 2018 03:03:16 +0000 (04:03 +0100)]
doc: typo "worksapce" -> "workspace"

occurs twice

6 years agodoc: [profile.*] sections are for root crate only
xftroxgpx [Sun, 7 Jan 2018 22:48:52 +0000 (23:48 +0100)]
doc: [profile.*] sections are for root crate only

ie.
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:

6 years agoAuto merge of #4909 - zackmdavis:tidy_paren, r=matklad
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).

6 years agoclean up an unused pair of parentheses
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).

6 years agoAuto merge of #4904 - alexcrichton:clean-docs, r=alexcrichton
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

6 years agoDelete the old docs, lift up the new
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

6 years agoAuto merge of #4898 - wking:license-pin-spdx, r=alexcrichton
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.

[2]: https://github.com/rust-lang/crates.io/pull/385
[3]: https://github.com/withoutboats/license-exprs/blob/5bdb5355540792234e10011b9bbe4766cd08ff26/src/lib.rs#L53-L56
[4]: https://github.com/spdx/license-list-data/blob/v3.0/licenses.md
[5]: https://github.com/spdx/license-list-data/tree/v2.4/website
[6]: https://botbot.me/mozilla/cargo/2018-01-04/?msg=95358280&page=2
[7]: https://lists.spdx.org/pipermail/spdx/2017-December/001159.html

6 years agosrc/doc/manifest: Parenthesis not supported in 'license'
W. Trevor King [Thu, 4 Jan 2018 19:29:10 +0000 (11:29 -0800)]
src/doc/manifest: Parenthesis not supported in 'license'

Document [1] where authors can find it.

[1]: https://github.com/withoutboats/license-exprs/issues/3

6 years agosrc/doc/manifest: Pin 'license' to SPDX 2.1 expressions and the 2.4 list
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].

[1]: https://github.com/rust-lang/cargo/issues/4888
[2]: https://github.com/rust-lang/crates.io/pull/385
[3]: https://github.com/withoutboats/license-exprs/blob/5bdb5355540792234e10011b9bbe4766cd08ff26/src/lib.rs#L53-L56
[4]: https://github.com/spdx/license-list-data/blob/v3.0/licenses.md
[5]: https://github.com/spdx/license-list-data/tree/v2.4/website
[6]: https://botbot.me/mozilla/cargo/2018-01-04/?msg=95358280&page=2

6 years agoAuto merge of #4896 - alexcrichton:bump, r=alexcrichton
bors [Thu, 4 Jan 2018 16:00:48 +0000 (16:00 +0000)]
Auto merge of #4896 - alexcrichton:bump, r=alexcrichton

Bump to 0.26.0

6 years agoBump to 0.26.0
Alex Crichton [Thu, 4 Jan 2018 16:00:08 +0000 (08:00 -0800)]
Bump to 0.26.0

6 years agoAuto merge of #4893 - xftroxgpx:smalltypo1, r=alexcrichton
bors [Thu, 4 Jan 2018 01:52:41 +0000 (01:52 +0000)]
Auto merge of #4893 - xftroxgpx:smalltypo1, r=alexcrichton

doc typo: "does contains" -> "does contain"

6 years agodoc typo: "does contains" -> "does contain"
xftroxgpx [Thu, 4 Jan 2018 01:30:24 +0000 (02:30 +0100)]
doc typo: "does contains" -> "does contain"

6 years agoAuto merge of #4884 - tromey:help-to-stdout, r=alexcrichton
bors [Wed, 3 Jan 2018 22:38:53 +0000 (22:38 +0000)]
Auto merge of #4884 - tromey:help-to-stdout, r=alexcrichton

Send --help output to stdout

Fixes #4878

6 years agoSend --help output to stdout
Tom Tromey [Mon, 1 Jan 2018 22:33:01 +0000 (15:33 -0700)]
Send --help output to stdout

Fixes #4878

6 years agoAuto merge of #4891 - MaloJaffre:compiler-docs-regression, r=alexcrichton
bors [Wed, 3 Jan 2018 20:43:03 +0000 (20:43 +0000)]
Auto merge of #4891 - MaloJaffre:compiler-docs-regression, r=alexcrichton

Try to fix a perf regression by updating log

Upgrade `log` to `0.4` in `cargo` and `cargotest`.

Cc: rust-lang/rust#47154.
6 years agoTry to fix a perf regression by updating log
Malo Jaffré [Wed, 3 Jan 2018 20:16:16 +0000 (21:16 +0100)]
Try to fix a perf regression by updating log

Upgrade `log` to `0.4` in `cargo` and `cargotest`.

6 years agoAuto merge of #4877 - steffengy:master, r=alexcrichton
bors [Wed, 3 Jan 2018 19:47:09 +0000 (19:47 +0000)]
Auto merge of #4877 - steffengy:master, r=alexcrichton

migrate to winapi 0.3

6 years agoTouch up style of Windows imports
Alex Crichton [Wed, 3 Jan 2018 19:25:28 +0000 (11:25 -0800)]
Touch up style of Windows imports

6 years agoAuto merge of #4889 - Eijebong:bump, r=alexcrichton
bors [Tue, 2 Jan 2018 20:27:56 +0000 (20:27 +0000)]
Auto merge of #4889 - Eijebong:bump, r=alexcrichton

Bump hex to 0.3

6 years agoBump hex to 0.3
Bastien Orivel [Tue, 2 Jan 2018 19:35:32 +0000 (20:35 +0100)]
Bump hex to 0.3

6 years agoAuto merge of #4885 - Eijebong:bump, r=alexcrichton
bors [Tue, 2 Jan 2018 18:07:56 +0000 (18:07 +0000)]
Auto merge of #4885 - Eijebong:bump, r=alexcrichton

Bump dependencies

Those dependencies didn't need any code change

6 years agoBump dependencies
Bastien Orivel [Tue, 2 Jan 2018 11:08:44 +0000 (12:08 +0100)]
Bump dependencies

Those dependencies didn't need any code change

6 years agomigrate to winapi 0.3
Steffen Butzer [Fri, 29 Dec 2017 22:32:39 +0000 (23:32 +0100)]
migrate to winapi 0.3

6 years agoAuto merge of #4876 - MaloJaffre:flate2, r=alexcrichton
bors [Fri, 29 Dec 2017 22:13:32 +0000 (22:13 +0000)]
Auto merge of #4876 - MaloJaffre:flate2, r=alexcrichton

Upgrade flate2 crate to 1.0 in cargotest

I've missed this part in my previous PR, sorry.
Unblocks rust#46278.

6 years agoUpgrade flate2 crate to 1.0 in cargotest
Malo Jaffré [Fri, 29 Dec 2017 22:01:27 +0000 (23:01 +0100)]
Upgrade flate2 crate to 1.0 in cargotest

I've missed this part in my previous PR, sorry.
Unblocks rust#46278.

6 years agoAuto merge of #4872 - MaloJaffre:flate-1.0, r=alexcrichton
bors [Fri, 29 Dec 2017 16:18:31 +0000 (16:18 +0000)]
Auto merge of #4872 - MaloJaffre:flate-1.0, r=alexcrichton

Upgrade flate2 crate to 1.0

Unblocks rust-lang/rust#46278.

6 years agoUpgrade flate2 crate to 1.0
Malo Jaffré [Fri, 29 Dec 2017 14:37:22 +0000 (15:37 +0100)]
Upgrade flate2 crate to 1.0

Unblocks rust#46278.

6 years agoAuto merge of #4871 - fschutt:master, r=matklad
bors [Fri, 29 Dec 2017 12:19:53 +0000 (12:19 +0000)]
Auto merge of #4871 - fschutt:master, r=matklad

Update cargo tests for https://github.com/rust-lang/rust/pull/47052

This test message currently breaks the build. The old error message was:

```
error: could not exec the linker `cc`: No such file or directory (os error 2)
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/felix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "hello.hello0.rcgu.o" "hello.hello1.rcgu.o" "-o" "hello" "hello.crate.allocator.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-L" "/home/felix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/felix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-d3700976135c3f09.rlib" "/home/felix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-8a207564cfc9f224.rlib" "/home/felix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-4712d699ce2d50e5.rlib" "/home/felix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-7224935811a361fe.rlib" "/home/felix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_system-3343c92f30e63266.rlib" "/home/felix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-6e8aafa8bd1a67de.rlib" "/home/felix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-a8b7c0565b6366c3.rlib" "/home/felix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_unicode-512049fc390dec2e.rlib" "/home/felix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-ba1f12eb6cef9a1a.rlib" "/home/felix/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-53aab67ab6317c59.rlib" "-Wl,-Bdynamic" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util" "-l" "util"

error: aborting due to previous error
```

The new error message is:

```
error: linker `cc` not found
  |
  = note: No such file or directory (os error 2)

error: aborting due to previous error
```

This currently breaks https://github.com/rust-lang/rust/pull/47052.

**NOTE:** I don't know if I handled the "ticks" around the linker name correctly (if cargo test is smart enough to see that the ticks are part of the omitted part). My reasoning was that in the rustc code the ticks are in the source and not part of the linkers name - so if rustc changes, this will probably break again.

EDIT: fixed error message

6 years agoUpdate cargo tests for https://github.com/rust-lang/rust/pull/47052
Felix Schütt [Fri, 29 Dec 2017 10:46:07 +0000 (11:46 +0100)]
Update cargo tests for https://github.com/rust-lang/rust/pull/47052

6 years agoAuto merge of #4859 - alexcrichton:better-test-fail, r=alexcrichton
bors [Sun, 24 Dec 2017 03:46:44 +0000 (03:46 +0000)]
Auto merge of #4859 - alexcrichton:better-test-fail, r=alexcrichton

Write invalid data when cloning to force an abort

Otherwise it seems libgit2 isn't ready to handle premature eof? Unclear...

6 years agoWrite invalid data when cloning to force an abort
Alex Crichton [Sun, 24 Dec 2017 03:45:37 +0000 (19:45 -0800)]
Write invalid data when cloning to force an abort

Otherwise it seems libgit2 isn't ready to handle premature eof? Unclear...

6 years agoAuto merge of #4857 - alexcrichton:better-test-fail, r=alexcrichton
bors [Sat, 23 Dec 2017 15:43:50 +0000 (15:43 +0000)]
Auto merge of #4857 - alexcrichton:better-test-fail, r=alexcrichton

Make the `failed_submodule_checkout` test more robust

Hopefully should help diagnose deadlocks in rust-lang/rust

6 years agoMake the `failed_submodule_checkout` test more robust
Alex Crichton [Sat, 23 Dec 2017 15:43:08 +0000 (07:43 -0800)]
Make the `failed_submodule_checkout` test more robust

Hopefully should help diagnose deadlocks in rust-lang/rust

6 years agoAuto merge of #4852 - jtgeibel:cargo-install-target-dir, r=alexcrichton
bors [Fri, 22 Dec 2017 16:55:35 +0000 (16:55 +0000)]
Auto merge of #4852 - jtgeibel:cargo-install-target-dir, r=alexcrichton

Always respect `CARGO_TARGET_DIR` during `cargo install`

This aligns the behavior of crates.io and `--git` sources with that of `--path`
regarding the `CARGO_TARGET_DIR` and `CARGO_BUILD_TARGET_DIR` environment
variables.  If neither environment variable is set, then a temporary directory
is still used when installing from crates.io or `--git`.

As discussed in #4725, this can be used to enable caching of artifacts between
continuous integration builds.

/cc @alexcrichton, @ishanjain28

6 years agoAuto merge of #4856 - alexcrichton:no-revoke, r=alexcrichton
bors [Fri, 22 Dec 2017 16:08:01 +0000 (16:08 +0000)]
Auto merge of #4856 - alexcrichton:no-revoke, r=alexcrichton

Forcibly remove CARGO_HTTP_CHECK_REVOKE when testing

This'll tweak error messages and cause tests to fail

6 years agoForcibly remove CARGO_HTTP_CHECK_REVOKE when testing
Alex Crichton [Fri, 22 Dec 2017 16:07:20 +0000 (08:07 -0800)]
Forcibly remove CARGO_HTTP_CHECK_REVOKE when testing

This'll tweak error messages and cause tests to fail

6 years agoAlways respect `CARGO_TARGET_DIR` during `cargo install`
Justin Geibel [Fri, 22 Dec 2017 01:14:12 +0000 (20:14 -0500)]
Always respect `CARGO_TARGET_DIR` during `cargo install`

This aligns the behavior of crates.io and `--git` sources with that of `--path`
regarding the `CARGO_TARGET_DIR` and `CARGO_BUILD_TARGET_DIR` environment
variables.  If neither environment variable is set, then a temporary directory
is still used when installing from crates.io or `--git`.

As discussed in #4725, this can be used to enable caching of artifacts between
continuous integration builds.

6 years agoAuto merge of #4851 - sfackler:verify-in-target, r=alexcrichton
bors [Thu, 21 Dec 2017 23:38:31 +0000 (23:38 +0000)]
Auto merge of #4851 - sfackler:verify-in-target, r=alexcrichton

Untar into the right dir when verifying

We'd previously dump it in the package's directory which is wrong when
working in a workspace.

Closes #4304

r? @alexcrichton

6 years agoUntar into the right dir when verifying
Steven Fackler [Thu, 21 Dec 2017 21:58:49 +0000 (13:58 -0800)]
Untar into the right dir when verifying

We'd previously dump it in the package's directory which is wrong when
working in a workspace.

Closes #4304

6 years agoAuto merge of #4817 - alexcrichton:incremental-by-default, r=matklad
bors [Thu, 21 Dec 2017 18:57:07 +0000 (18:57 +0000)]
Auto merge of #4817 - alexcrichton:incremental-by-default, r=matklad

Enable incremental by default

This commit enables incremental compilation by default in Cargo for all
dev-related profiles (aka anything without `--release` or `bench`. A
number of new configuration options were also added to tweak how
incremental compilation is exposed and/or used:

* A `profile.dev.incremental` field is added to `Cargo.toml` to disable
  it on a per-project basis (in case of bugs).
* A `build.incremental` field was added in `.cargo/config` to disable
  globally (or enable if we flip this default back off).

Otherwise `CARGO_INCREMENTAL` can still be used to configure one
particular compilation. The global `build.incremental` configuration
cannot currently be used to enable it for the release profile.

6 years agoEnable incremental by default
Alex Crichton [Wed, 13 Dec 2017 22:08:16 +0000 (14:08 -0800)]
Enable incremental by default

This commit enables incremental compilation by default in Cargo for all
dev-related profiles (aka anything without `--release` or `bench`. A
number of new configuration options were also added to tweak how
incremental compilation is exposed and/or used:

* A `profile.dev.incremental` field is added to `Cargo.toml` to disable
  it on a per-project basis (in case of bugs).
* A `build.incremental` field was added in `.cargo/config` to disable
  globally (or enable if we flip this default back off).

Otherwise `CARGO_INCREMENTAL` can still be used to configure one
particular compilation. The global `build.incremental` configuration
cannot currently be used to enable it for the release profile.

6 years agoAuto merge of #4837 - alexcrichton:failed-submodule-checkout, r=matklad
bors [Wed, 20 Dec 2017 15:01:01 +0000 (15:01 +0000)]
Auto merge of #4837 - alexcrichton:failed-submodule-checkout, r=matklad

Fix updating submodules past failures

If a submodule-of-a-submodule failed to update then Cargo the next time
around wouldn't automatically retry updating the next submodule. This commit
fixes that by ensuring that if a parent git repository looks updated we still
recurse into its own submodules to ensure they're all updated.

cc #4071

6 years agoFix updating submodules past failures
Alex Crichton [Tue, 19 Dec 2017 15:34:14 +0000 (07:34 -0800)]
Fix updating submodules past failures

If a submodule-of-a-submodule failed to update then Cargo the next time
around wouldn't automatically retry updating the next submodule. This commit
fixes that by ensuring that if a parent git repository looks updated we still
recurse into its own submodules to ensure they're all updated.

cc #4071

6 years agoAuto merge of #4838 - Manishearth:die-qquote, r=alexcrichton
bors [Tue, 19 Dec 2017 22:14:25 +0000 (22:14 +0000)]
Auto merge of #4838 - Manishearth:die-qquote, r=alexcrichton

Remove usage of quasi-quoting in tests

Only clippy and cargo use the old quasi quoting stuff, and we should be
removing it.

r? @alexcrichton

6 years agoRemove usage of quasi-quoting in tests
Manish Goregaokar [Tue, 19 Dec 2017 20:27:51 +0000 (12:27 -0800)]
Remove usage of quasi-quoting in tests

Only clippy and cargo use the old quasi quoting stuff, and we should be
removing it.

6 years agoAuto merge of #4791 - nox:dupe-flags, r=alexcrichton
bors [Tue, 19 Dec 2017 03:33:36 +0000 (03:33 +0000)]
Auto merge of #4791 - nox:dupe-flags, r=alexcrichton

Don't accumulate feature and rustdoc flags twice (fixes #4790)

6 years agoAuto merge of #4795 - alexcrichton:failure, r=withoutboats
bors [Tue, 19 Dec 2017 02:48:27 +0000 (02:48 +0000)]
Auto merge of #4795 - alexcrichton:failure, r=withoutboats

Start migration to the `failure` crate

This commit is the initial steps to migrate Cargo's error handling from the
`error-chain` crate to the `failure` crate. This is intended to be a low-cost
(in terms of diff) transition where possible so it's note "purely idiomatic
`failure` crate" just yet.

The `error-chain` dependency is dropped in this commit and Cargo now canonically
uses the `Error` type from the `failure` crate. The main last remnant of
`error-chain` is a custom local extension trait to use `chain_err` instead of
`with_context`. I'll try to follow up with a commit that renames this later but
I wanted to make sure everything worked first! (and `chain_err` is used
practically everywhere).

Some minor tweaks happened in the tests as I touched up a few error messages
here and there but overall the UI of Cargo should be exactly the same before and
after this commit.

6 years agoAuto merge of #4836 - sfackler:dl-template, r=withoutboats
bors [Tue, 19 Dec 2017 01:48:52 +0000 (01:48 +0000)]
Auto merge of #4836 - sfackler:dl-template, r=withoutboats

Template a registry's dl field

Previously, crate files were always downloaded from
`/{crate}/{version}/download`. However, if the backing crate store for a
custom registry is a raw file server rather than an API endpoint that
requires every file to be named `download` which is a bit weird. Now a
registry's dl URL can be templated with `{crate}` and `{version}` to
have more control over the resulting path.

For backwards compatibility, we append the default template suffix onto
the dl URL if neither of the template parameters are present for
backwards compatibility.

r? @alexcrichton

cc @withoutboats

6 years agoStart migration to the `failure` crate
Alex Crichton [Fri, 8 Dec 2017 19:31:17 +0000 (11:31 -0800)]
Start migration to the `failure` crate

This commit is the initial steps to migrate Cargo's error handling from the
`error-chain` crate to the `failure` crate. This is intended to be a low-cost
(in terms of diff) transition where possible so it's note "purely idiomatic
`failure` crate" just yet.

The `error-chain` dependency is dropped in this commit and Cargo now canonically
uses the `Error` type from the `failure` crate. The main last remnant of
`error-chain` is a custom local extension trait to use `chain_err` instead of
`with_context`. I'll try to follow up with a commit that renames this later but
I wanted to make sure everything worked first! (and `chain_err` is used
practically everywhere).

Some minor tweaks happened in the tests as I touched up a few error messages
here and there but overall the UI of Cargo should be exactly the same before and
after this commit.

6 years agoAvoid an intermediate allocation
Steven Fackler [Tue, 19 Dec 2017 00:47:35 +0000 (16:47 -0800)]
Avoid an intermediate allocation

6 years agoFix test for Windows
Steven Fackler [Tue, 19 Dec 2017 00:45:24 +0000 (16:45 -0800)]
Fix test for Windows

6 years agoAuto merge of #4832 - andreastt:dumb_terminal_progress, r=alexcrichton
bors [Tue, 19 Dec 2017 00:41:01 +0000 (00:41 +0000)]
Auto merge of #4832 - andreastt:dumb_terminal_progress, r=alexcrichton

util/progress: no progress reporting in dumb terminals

cargo should not assume that all terminals have direct access to
the terminal.  Dumb terminals are those that can interpret only a
limited number of control codes (CR, LF, &c.) and the escape codes
used by the progress bar breaks output in these by asserting control
over the cursor position to draw a bar.

A dumb terminal is identified by the TERM output variable being set to
"dumb".  This adds a direct check for this in src/cargo/util/progress.rs
because TERM=dumb does not imply the same as the -q flag.

6 years agoTemplate a registry's dl field
Steven Fackler [Mon, 18 Dec 2017 23:22:04 +0000 (15:22 -0800)]
Template a registry's dl field

Previously, crate files were always downloaded from
`/{crate}/{version}/download`. However, if the backing crate store for a
custom registry is a raw file server rather than an API endpoint that
requires every file to be named `download` which is a bit weird. Now a
registry's dl URL can be templated with `{crate}` and `{version}` to
have more control over the resulting path.

For backwards compatibility, we append the default template suffix onto
the dl URL if neither of the template parameters are present for
backwards compatibility.

6 years agoAuto merge of #4818 - alexcrichton:rename-link-paths, r=matklad
bors [Mon, 18 Dec 2017 19:30:28 +0000 (19:30 +0000)]
Auto merge of #4818 - alexcrichton:rename-link-paths, r=matklad

Fix renaming a project using build scripts

This commit fixes an issue in Cargo where if a project's folder was
renamed but it also contained a build script the project could break.
Cargo would continue to use the previous `rustc-link-search` arguments
to configure env vars like `LD_LIBRARY_PATH` but the literal values from
the previous compilation would be stale as the directories would no
longer be there.

To fix this when parsing the build script output we now retain a log of
the previous output directory of a build script invocation as well as
the current output, tweaking paths as appropriate if they were contained
in the output folder.

Closes #4053

6 years agoFix renaming a project using build scripts
Alex Crichton [Thu, 14 Dec 2017 04:54:01 +0000 (20:54 -0800)]
Fix renaming a project using build scripts

This commit fixes an issue in Cargo where if a project's folder was
renamed but it also contained a build script the project could break.
Cargo would continue to use the previous `rustc-link-search` arguments
to configure env vars like `LD_LIBRARY_PATH` but the literal values from
the previous compilation would be stale as the directories would no
longer be there.

To fix this when parsing the build script output we now retain a log of
the previous output directory of a build script invocation as well as
the current output, tweaking paths as appropriate if they were contained
in the output folder.

Closes #4053

6 years agoutil/progress: no progress reporting in dumb terminals
Andreas Tolfsen [Mon, 18 Dec 2017 16:01:30 +0000 (16:01 +0000)]
util/progress: no progress reporting in dumb terminals

cargo should not assume that all terminals have direct access to
the terminal.  Dumb terminals are those that can interpret only a
limited number of control codes (CR, LF, &c.) and the escape codes
used by the progress bar breaks output in these by asserting control
over the cursor position to draw a bar.

A dumb terminal is identified by the TERM output variable being set to
"dumb".  This adds a direct check for this in src/cargo/util/progress.rs
because TERM=dumb does not imply the same as the -q flag.

6 years agoAuto merge of #4828 - SimonSapin:virtual-err, r=alexcrichton
bors [Mon, 18 Dec 2017 15:13:48 +0000 (15:13 +0000)]
Auto merge of #4828 - SimonSapin:virtual-err, r=alexcrichton

Don’t swallow virtual manifest parsing errors

Before this change, `cargo::util::toml::do_read_manifest` ended like this:

```rust
    return match TomlManifest::to_real_manifest(/* … */) {
        Ok(/* … */) => /* … */,
        Err(e) => match TomlManifest::to_virtual_manifest(/* … */) {
            Ok(/* … */) => /* … */,
            Err(..) => Err(e),
        }
    };
```

Errors returned by `to_virtual_manifest` were always ignored. As a result, when something was wrong in a virtual manifest, Cargo would unhelpfully exit with no more output than:

```
error: failed to parse manifest at `/tmp/a/Cargo.toml`

Caused by:
  no `package` section found.
```

http://doc.crates.io/manifest.html#virtual-manifest defines a virtual manifest as “the `package` table is not present”, so let’s first determine if a manifest is virtual based on that criteria, and then only call one of the two methods.

Although it is not mentioned in the documentation, `[project]` seems to be in the code an alias for `[package]`. So let’s preserve that here too.

6 years agoDon’t swallow virtual manifest parsing errors
Simon Sapin [Sun, 17 Dec 2017 21:58:51 +0000 (22:58 +0100)]
Don’t swallow virtual manifest parsing errors

Before this change, `cargo::util::toml::do_read_manifest` ended like this:

```rust
    return match TomlManifest::to_real_manifest(/* … */) {
        Ok(/* … */) => /* … */,
        Err(e) => match TomlManifest::to_virtual_manifest(/* … */) {
            Ok(/* … */) => /* … */,
            Err(..) => Err(e),
        }
    };
```

Errors returned by `to_virtual_manifest` were always ignored.
As a result, when something was wrong in a virtual manifest,
Cargo would unhelpfully exit with no more output than:

```
error: failed to parse manifest at `/tmp/a/Cargo.toml`

Caused by:
  no `package` section found.
```

http://doc.crates.io/manifest.html#virtual-manifest defines
a virtual manifest as “the `package` table is not present”,
so let’s first determine if a manifest is virtual based
on that criteria, and then only call one of the two methods.

Although it is not mentioned in the documentation,
`[project]` seems to be in the code an alias for `[package]`.
So let’s preserve that here too.

6 years agoAuto merge of #4826 - alexcrichton:silence-progress, r=matklad
bors [Sat, 16 Dec 2017 17:10:25 +0000 (17:10 +0000)]
Auto merge of #4826 - alexcrichton:silence-progress, r=matklad

Don't print a progress bar in quiet mode

Closes #4825

6 years agoDon't print a progress bar in quiet mode
Alex Crichton [Sat, 16 Dec 2017 15:22:51 +0000 (07:22 -0800)]
Don't print a progress bar in quiet mode

Closes #4825

6 years agoAuto merge of #4823 - johnthagen:patch-1, r=alexcrichton
bors [Sat, 16 Dec 2017 15:01:08 +0000 (15:01 +0000)]
Auto merge of #4823 - johnthagen:patch-1, r=alexcrichton

Add note about running clean before using -vv for build script development

This solves an issue that came up in the beginners chat that took about fifteen minutes to finally understand what was going on.

This should help users who are actively developing `build.rs` consistently get debugging information printed to the terminal.

6 years agoAuto merge of #4822 - integer32llc:more-custom-http-transport, r=alexcrichton
bors [Fri, 15 Dec 2017 17:33:32 +0000 (17:33 +0000)]
Auto merge of #4822 - integer32llc:more-custom-http-transport, r=alexcrichton

Use the custom HTTP transport when any HTTP settings are present

6 years agoWe no longer need to workaround AppVeyor's SSL revocation
Jake Goulding [Fri, 15 Dec 2017 15:38:44 +0000 (09:38 -0600)]
We no longer need to workaround AppVeyor's SSL revocation

6 years agoAdd note about running clean before using -vv
johnthagen [Fri, 15 Dec 2017 15:05:21 +0000 (10:05 -0500)]
Add note about running clean before using -vv

This solves an issue that came up in the beginners chat that took about fifteen minutes to finally understand what was going on.

This should help users who are actively developing `build.rs` consistently get debugging information printed to the terminal.

6 years agoAuto merge of #4821 - aidanhs:aphs-allow-overflow, r=alexcrichton
bors [Thu, 14 Dec 2017 23:21:33 +0000 (23:21 +0000)]
Auto merge of #4821 - aidanhs:aphs-allow-overflow, r=alexcrichton

Remove overflow checks to eliminate rust build warnings

Although the checks are desirable, they cause warnings in the rust build (due to workspaces) which could cause needless concern. The checks aren't too important, so just disable them.

r? @alexcrichton (as discussed)

6 years agoRemove overflow checks to eliminate rust build warnings
Aidan Hobson Sayers [Thu, 14 Dec 2017 21:11:42 +0000 (21:11 +0000)]
Remove overflow checks to eliminate rust build warnings

Although the checks are desirable, they cause warnings in the rust build
(due to workspaces) which could cause needless concern. The checks
aren't too important, so just disable them.

6 years agoUse the custom HTTP transport when any HTTP settings are present
Jake Goulding [Mon, 11 Dec 2017 00:31:55 +0000 (19:31 -0500)]
Use the custom HTTP transport when any HTTP settings are present

6 years agoAuto merge of #4816 - alexcrichton:fix-workspace-is-home, r=matklad
bors [Wed, 13 Dec 2017 21:22:53 +0000 (21:22 +0000)]
Auto merge of #4816 - alexcrichton:fix-workspace-is-home, r=matklad

Defer bailing out workspace root probing

This commit alters the logic to bail out on probing for `CARGO_HOME` to
do it a little later rather than early on in the loop iteration, notably
allowing members to reside in `CARGO_HOME` itself.

Closes #4815

6 years agoDefer bailing out workspace root probing
Alex Crichton [Wed, 13 Dec 2017 21:19:12 +0000 (13:19 -0800)]
Defer bailing out workspace root probing

This commit alters the logic to bail out on probing for `CARGO_HOME` to
do it a little later rather than early on in the loop iteration, notably
allowing members to reside in `CARGO_HOME` itself.

Closes #4815

6 years agoAuto merge of #4812 - tomprince:patch-1, r=matklad
bors [Tue, 12 Dec 2017 20:25:27 +0000 (20:25 +0000)]
Auto merge of #4812 - tomprince:patch-1, r=matklad

Fix comment typo.

6 years agoAuto merge of #4788 - alexcrichton:rename-works, r=matklad
bors [Tue, 12 Dec 2017 20:00:10 +0000 (20:00 +0000)]
Auto merge of #4788 - alexcrichton:rename-works, r=matklad

Avoid rebuilding a project when cwd changes

This commit is targeted at solving a use case which typically comes up during CI
builds -- the `target` directory is cached between builds but the cwd of the
build changes over time. For example the following scenario can happen:

1. A project is compiled at `/projects/a`.
2. The `target` directory is cached.
3. A new build is started in `/projects/b`.
4. The previous `target` directory is restored to `/projects/b`.
5. The build start, and Cargo rebuilds everything.

The last piece of behavior is indeed unfortunate! Cargo's internal hashing
currently isn't that resilient to changing cwd and this PR aims to help improve
the situation!

The first point of too-much-hashing came up with `Target::src_path`. Each
`Target` was hashed and stored for all compilations, and the `src_path` field
was an absolute path on the filesystem to the file that needed to be compiled.
This path then changed over time when cwd changed, but otherwise everything else
remained the same!

This commit updates the handling of the `src_path` field to simply ignore it
when hashing. Instead the path we actually pass to rustc is later calculated and
then passed to the fingerprint calculation.

The next problem this fixes is that the dep info files were augmented after
creation to have the cwd of the compiler at the time to find the files at a
later date. This, unfortunately, would cause issues if the cwd itself changed.
Instead the cwd is now left out of dep-info files (they're no longer augmented)
and instead the cwd is recalculated when parsing the dep info later.

The final problem that this commit fixes is actually an existing issue in Cargo
today. Right now you can actually execute `cargo build` from anywhere in a
project and Cargo will execute the build. Unfortunately though the argument to
rustc was actually different depending on what directory you were in (the
compiler was invoked with a path relative to cwd). This path ends up being used
for metadata like debuginfo which means that different directories would cause
different artifacts to be created, but Cargo wouldn't rerun the compiler!

To fix this issue the matter of cwd is now entirely excluded from compilation
command lines. Instead rustc is unconditionally invoked with a relative path
*if* the path is underneath the workspace root, and otherwise it's invoked as an
absolute path (in which case the cwd doesn't matter).

Once all these fixes were added up it means that now we can have projects where
if you move the entire directory Cargo won't rebuild the original source!

Note that this may be a bit of a breaking change, however. This means that the
paths in error messages for cargo will no longer be unconditionally relative to
the current working directory, but rather relative to the root of the workspace
itself. Unfortunately this is moreso of a feature right now rather than a bug,
so it may be one that we just have to stomach.

Closes https://github.com/rust-lang/cargo/issues/3273

6 years agoFix comment typo.
Tom Prince [Tue, 12 Dec 2017 19:24:35 +0000 (12:24 -0700)]
Fix comment typo.

6 years agoChange Cargo's own dep-file format
Alex Crichton [Fri, 8 Dec 2017 15:43:45 +0000 (07:43 -0800)]
Change Cargo's own dep-file format

This commit alters the format of the dependency info that Cargo keeps track of
for each crate. In order to be more resilient against directory renames and such
Cargo will now postprocess the compiler's dep-info output and serialize into its
own format. This format is intended to primarily list relative paths *to the
root of the relevant package* rather than absolute or relative to some other
location. If paths aren't actually relative to the package root they're still
stored as absolute, but there's not much we can do about that!

6 years agoAuto merge of #4806 - alexcrichton:fix-infinite-loop, r=matklad
bors [Tue, 12 Dec 2017 05:41:53 +0000 (05:41 +0000)]
Auto merge of #4806 - alexcrichton:fix-infinite-loop, r=matklad

Fix an infinite loop in error reporting

The `path_to_root` function unfortunately didn't account for cycles in the
dependency graph introduced through dev-dependencies, so if a cycle was present
then the function would infinitely loop pushing items onto a vector.

This commit fixes the infinite loop and also touches up the reporting to be a
little more consistent with the rest of Cargo