]> git.proxmox.com Git - cargo.git/log
cargo.git
7 years agoCut down allocations in Display impls
Alex Crichton [Fri, 2 Jun 2017 14:21:50 +0000 (07:21 -0700)]
Cut down allocations in Display impls

Avoid unnecessary `String` allocations in hot paths that get run a lot for large
graphs.

7 years agoOptimize allocations in the registry index
Alex Crichton [Fri, 2 Jun 2017 13:57:43 +0000 (06:57 -0700)]
Optimize allocations in the registry index

Avoid some unnecessary clones, `to_vec`, etc. Not super optimizal but improves
the profile here regardless.

7 years agoOptimize the interface of `Registry`.
Alex Crichton [Fri, 2 Jun 2017 05:33:02 +0000 (22:33 -0700)]
Optimize the interface of `Registry`.

Previously all intermediate stages would create and return `Vec<Summary>`, but
this is a pretty costly operation once you start layering. Ideally we'd use an
iterator-based approach here but working with that in trait objects is
difficult, so this commit takes a closure-based approach to avoid all the
intermediate allocations that are thrown away.

7 years agoTry to not allocate when decoding registry json
Alex Crichton [Fri, 2 Jun 2017 14:00:17 +0000 (07:00 -0700)]
Try to not allocate when decoding registry json

There's a few keys we don't need owned versions of, so try using Serde's
zero-copy deserialization where we can.

7 years agoUse `Rc::make_mut` in `Dependency`
Alex Crichton [Fri, 2 Jun 2017 13:59:16 +0000 (06:59 -0700)]
Use `Rc::make_mut` in `Dependency`

Follow the same pattern with `Summary`

7 years agoMake `Summary::clone` cheap with an inner `Rc`
Alex Crichton [Fri, 2 Jun 2017 13:59:04 +0000 (06:59 -0700)]
Make `Summary::clone` cheap with an inner `Rc`

This already happens in a few other places in Cargo (e.g. `Dependency`) and
`Summary` cloning turned up high in the profile, so let's make it cheaper.

7 years agoOptimize resolution by removing allocations
Alex Crichton [Fri, 4 Nov 2016 00:18:48 +0000 (17:18 -0700)]
Optimize resolution by removing allocations

This commit is a relatively serious optimization pass of the resolution phase in
Cargo, targeted at removing as many allocations as possible from this phase.
Executed as an iterative loop this phase of Cargo can often be costly for large
graphs but it's run on every single build!

The main optimization here is to avoid cloning the context and/or pushing a
backtracking frame if there are no candidates left in the current list of
candidates. That optimizes a fast-path for crates with lock files (almost all of
them) and gets us to the point where cloning the context basically disappears
from all profiling.

7 years agoAuto merge of #4119 - fabricedesre:patch-1, r=alexcrichton
bors [Sat, 3 Jun 2017 17:54:43 +0000 (17:54 +0000)]
Auto merge of #4119 - fabricedesre:patch-1, r=alexcrichton

Fix typo in argument name.

7 years agoFix typo in argument name.
Fabrice Desré [Sat, 3 Jun 2017 01:51:09 +0000 (18:51 -0700)]
Fix typo in argument name.

7 years agoAuto merge of #4110 - alexcrichton:jobserver, r=matklad
bors [Fri, 2 Jun 2017 22:53:36 +0000 (22:53 +0000)]
Auto merge of #4110 - alexcrichton:jobserver, r=matklad

Add a GNU make jobserver implementation to Cargo

This commit adds a GNU make jobserver implementation to Cargo, both as a client
of existing jobservers and also a creator of new jobservers. The jobserver is
actually just an IPC semaphore which manifests itself as a pipe with N bytes
of tokens on Unix and a literal IPC semaphore on Windows. The rough protocol
is then if you want to run a job you read acquire the semaphore (read a byte on
Unix or wait on the semaphore on Windows) and then you release it when you're
done.

All the hairy details of the jobserver implementation are housed in the
`jobserver` crate on crates.io instead of Cargo. This should hopefully make it
much easier for the compiler to also share a jobserver implementation
eventually.

The main tricky bit here is that on Unix and Windows acquiring a jobserver token
will block the calling thread. We need to either way for a running job to exit
or to acquire a new token when we want to spawn a new job. To handle this the
current implementation spawns a helper thread that does the blocking and sends a
message back to Cargo when it receives a token. It's a little trickier with
shutting down this thread gracefully as well but more details can be found in
the `jobserver` crate.

Unfortunately crates are unlikely to see an immediate benefit of this once
implemented. Most crates are run with a manual `make -jN` and this overrides the
jobserver in the environment, creating a new jobserver in the sub-make. If the
`-jN` argument is removed, however, then `make` will share Cargo's jobserver and
properly limit parallelism.

Closes #1744

7 years agoAdd a GNU make jobserver implementation to Cargo
Alex Crichton [Tue, 30 May 2017 04:09:53 +0000 (21:09 -0700)]
Add a GNU make jobserver implementation to Cargo

This commit adds a GNU make jobserver implementation to Cargo, both as a client
of existing jobservers and also a creator of new jobservers. The jobserver is
actually just an IPC semaphore which manifests itself as a pipe with N bytes
of tokens on Unix and a literal IPC semaphore on Windows. The rough protocol
is then if you want to run a job you read acquire the semaphore (read a byte on
Unix or wait on the semaphore on Windows) and then you release it when you're
done.

All the hairy details of the jobserver implementation are housed in the
`jobserver` crate on crates.io instead of Cargo. This should hopefully make it
much easier for the compiler to also share a jobserver implementation
eventually.

The main tricky bit here is that on Unix and Windows acquiring a jobserver token
will block the calling thread. We need to either way for a running job to exit
or to acquire a new token when we want to spawn a new job. To handle this the
current implementation spawns a helper thread that does the blocking and sends a
message back to Cargo when it receives a token. It's a little trickier with
shutting down this thread gracefully as well but more details can be found in
the `jobserver` crate.

Unfortunately crates are unlikely to see an immediate benefit of this once
implemented. Most crates are run with a manual `make -jN` and this overrides the
jobserver in the environment, creating a new jobserver in the sub-make. If the
`-jN` argument is removed, however, then `make` will share Cargo's jobserver and
properly limit parallelism.

Closes #1744

7 years agoAuto merge of #4117 - brson:vs2017, r=alexcrichton
bors [Thu, 1 Jun 2017 22:20:28 +0000 (22:20 +0000)]
Auto merge of #4117 - brson:vs2017, r=alexcrichton

Update gcc crate for MSVC 2017

This is just a slightly more correct version of the gcc crate, but shouldn't have any practical changes.

7 years agoAuto merge of #4116 - alexcrichton:enotsupp, r=Mark-Simulacrum
bors [Thu, 1 Jun 2017 21:07:58 +0000 (21:07 +0000)]
Auto merge of #4116 - alexcrichton:enotsupp, r=Mark-Simulacrum

Ignore ENOTSUP in file locking on Linux too

Apparently there are some filesystems that return this!

Closes #4096

7 years agoUpdate gcc crate for MSVC 2017
Brian Anderson [Thu, 1 Jun 2017 21:01:17 +0000 (21:01 +0000)]
Update gcc crate for MSVC 2017

7 years agoIgnore ENOTSUP in file locking on Linux too
Alex Crichton [Thu, 1 Jun 2017 19:24:51 +0000 (12:24 -0700)]
Ignore ENOTSUP in file locking on Linux too

Apparently there are some filesystems that return this!

Closes #4096

7 years agoAuto merge of #4038 - nisargthakkar:newBadgesAdd, r=alexcrichton
bors [Thu, 1 Jun 2017 16:53:07 +0000 (16:53 +0000)]
Auto merge of #4038 - nisargthakkar:newBadgesAdd, r=alexcrichton

Updating doc to reflect new badges added

The badges added are:
Is it maintained: Resolution time
Is it maintained: Percentage of open issues
Codecov: Code coverage
Coveralls: Code coverage

7 years agoAuto merge of #4090 - jluner:master, r=alexcrichton
bors [Wed, 31 May 2017 22:51:31 +0000 (22:51 +0000)]
Auto merge of #4090 - jluner:master, r=alexcrichton

Add error-chain errors.

Fixes #4209

Convert CargoResult, CargoError into an implementation provided by error-chain. The previous is_human machinery is mostly removed; now errors are displayed unless of the Internal kind, verbose mode will print all errors.

7 years agoAuto merge of #4113 - alexcrichton:trim-travis, r=alexcrichton
bors [Wed, 31 May 2017 21:23:36 +0000 (21:23 +0000)]
Auto merge of #4113 - alexcrichton:trim-travis, r=alexcrichton

Remove lots of dated configuration from this repo

Lots of data build stuff is still here from awhile ago when this repo was
producing Cargo binaries, but the rust-lang/rust repo is now responsible for all
these binaries and build configurations. We no longer need to produce artifacts
or have tons of cross-compiles as rust-lang/rust does all that work, instead
let's just test the likely-to-regress platforms and have rust-lang/rust take
care of the rest.

This commit:

* Deletes the old `configure` script and `Makefile`
* Rewrites `src/doc` management as a shell script
* Trims down Travis/AppVeyor configuration

7 years agoRemove lots of dated configuration from this repo
Alex Crichton [Wed, 31 May 2017 19:55:47 +0000 (12:55 -0700)]
Remove lots of dated configuration from this repo

Lots of data build stuff is still here from awhile ago when this repo was
producing Cargo binaries, but the rust-lang/rust repo is now responsible for all
these binaries and build configurations. We no longer need to produce artifacts
or have tons of cross-compiles as rust-lang/rust does all that work, instead
let's just test the likely-to-regress platforms and have rust-lang/rust take
care of the rest.

This commit:

* Deletes the old `configure` script and `Makefile`
* Rewrites `src/doc` management as a shell script
* Trims down Travis/AppVeyor configuration

7 years agoFixes review comments
jluner [Wed, 31 May 2017 03:15:07 +0000 (22:15 -0500)]
Fixes review comments

Fix some formatting items.
Changes Internal error kind to preserve the original error.
Changes network retry logic to inspect full error chain for spurious
errors.

7 years agoRestore macro_use
jluner [Sun, 28 May 2017 15:13:59 +0000 (10:13 -0500)]
Restore macro_use

7 years agoResolve upstream updates to referenced crates
jluner [Sun, 28 May 2017 04:50:55 +0000 (23:50 -0500)]
Resolve upstream updates to referenced crates

7 years agoMerge remote-tracking branch 'upstream/master'
jluner [Sun, 28 May 2017 03:27:59 +0000 (22:27 -0500)]
Merge remote-tracking branch 'upstream/master'

7 years agoFix formatting issue blocking build
jluner [Sun, 28 May 2017 03:24:40 +0000 (22:24 -0500)]
Fix formatting issue blocking build

7 years agoAuto merge of #4107 - alexcrichton:update-deps, r=alexcrichton
bors [Sun, 28 May 2017 01:02:13 +0000 (01:02 +0000)]
Auto merge of #4107 - alexcrichton:update-deps, r=alexcrichton

Update a slew of dependencies and such

Standard bug fixes and otherwise keeping up to date

7 years agoUpdate a slew of dependencies and such
Alex Crichton [Sat, 27 May 2017 23:42:10 +0000 (16:42 -0700)]
Update a slew of dependencies and such

Standard bug fixes and otherwise keeping up to date

7 years agoAuto merge of #4031 - torkleyy:exclude, r=alexcrichton
bors [Sat, 27 May 2017 23:36:45 +0000 (23:36 +0000)]
Auto merge of #4031 - torkleyy:exclude, r=alexcrichton

Add --exclude flag

Allows to exclude packages in conjunction
with --all.

Addresses #2878

7 years agoFix build_all_exclude
torkleyy [Tue, 16 May 2017 17:44:05 +0000 (19:44 +0200)]
Fix build_all_exclude

by using with_stderr_contains because
parallel build may mix up the lines.

Additionally, remove the last line of
the benchmark.

7 years agoAdd tests for --exclude
torkleyy [Fri, 12 May 2017 13:44:15 +0000 (15:44 +0200)]
Add tests for --exclude

7 years agoAdd exclude flag to bench, check and test
torkleyy [Fri, 12 May 2017 13:05:28 +0000 (15:05 +0200)]
Add exclude flag to bench, check and test

7 years agoMove package flag handling into cargo_compile
torkleyy [Fri, 12 May 2017 12:16:48 +0000 (14:16 +0200)]
Move package flag handling into cargo_compile

7 years agoAdd --exclude flag
torkleyy [Thu, 11 May 2017 18:47:48 +0000 (20:47 +0200)]
Add --exclude flag

Allows to exclude packages in conjunction
with --all.

7 years agoUpdate gcc dependency to match updated gcc elsewhere in cargo
jluner [Sat, 27 May 2017 07:37:10 +0000 (02:37 -0500)]
Update gcc dependency to match updated gcc elsewhere in cargo

7 years agoMerge remote-tracking branch 'upstream/master'
jluner [Sat, 27 May 2017 07:29:15 +0000 (02:29 -0500)]
Merge remote-tracking branch 'upstream/master'

7 years agoFix failing tests
jluner [Sat, 27 May 2017 07:21:48 +0000 (02:21 -0500)]
Fix failing tests

7 years agoAuto merge of #4103 - brson:vs2017, r=alexcrichton
bors [Fri, 26 May 2017 17:30:08 +0000 (17:30 +0000)]
Auto merge of #4103 - brson:vs2017, r=alexcrichton

Update lockfile for gcc and cmake crates to pick up MSVC 2017 fixes

Seems to work.

7 years agoUpdate lockfile for gcc and cmake crates to pick up MSVC 2017 fixes
Brian Anderson [Thu, 25 May 2017 18:58:47 +0000 (18:58 +0000)]
Update lockfile for gcc and cmake crates to pick up MSVC 2017 fixes

7 years agoAuto merge of #4105 - birkenfeld:master, r=alexcrichton
bors [Fri, 26 May 2017 14:05:10 +0000 (14:05 +0000)]
Auto merge of #4105 - birkenfeld:master, r=alexcrichton

Do not output "Blocking - waiting for lock" with -q

This is not an error, so it should not be printed unconditionally
to stderr.  Since it can appear intermittently (e.g. due to editor
integration calling build every now and then) it will disturb
things that expect exact output from cargo (e.g. test suites).

7 years agoDo not output "Blocking - waiting for lock" with -q
Georg Brandl [Fri, 26 May 2017 08:07:29 +0000 (10:07 +0200)]
Do not output "Blocking - waiting for lock" with -q

This is not an error, so it should not be printed unconditionally
to stderr.  Since it can appear intermittently (e.g. due to editor
integration calling build every now and then) it will disturb
things that expect exact output from cargo (e.g. test suites).

7 years agoAuto merge of #4099 - matklad:ignore-root-target, r=alexcrichton
bors [Thu, 25 May 2017 16:50:10 +0000 (16:50 +0000)]
Auto merge of #4099 - matklad:ignore-root-target, r=alexcrichton

Ignore only root target directory

r? @alexcrichton

7 years agoIgnore only root target directory
Aleksey Kladov [Thu, 25 May 2017 16:47:15 +0000 (19:47 +0300)]
Ignore only root target directory

We used to ignore all target directories, because it was common to
have multiple packages with different target directories in a single
repository. Now, when workspaces are here, such setups usually have a
single target, and we can .gitignore only it. It's useful because
sometimes you want to have a module named `target` in Rust.

If you use non-workspaced multi-package setup, you can create a
.gitignore with `/target/` for each package.

7 years agoAddresses review comments
jluner [Thu, 25 May 2017 04:45:14 +0000 (23:45 -0500)]
Addresses review comments

* rebased
* removed `human` (deferring removing `internal` to a later PR)
* cargo_test.rs - fails on other error kinds
* unnecessary `map_err(CargoError::from)` removed
* fold NetworkError entirely into CargoError
* added justification comment for `extend_lifetime`
* various formatting goofs

The following tests are currently failing:
* `http_auth_offered`
* `custom_build_script_failed`
* `build_deps_for_the_right_arch`
* `dep_with_bad_submodule`
* `update_with_shared_deps`
* `finds_author_email`
* `finds_author_user`
* `finds_author_user_escaped`
* `finds_author_username`
* `finds_git_author`
* `exit_code`

7 years agoAuto merge of #4098 - callahad:remove-superfluous-semis, r=alexcrichton
bors [Thu, 25 May 2017 03:05:53 +0000 (03:05 +0000)]
Auto merge of #4098 - callahad:remove-superfluous-semis, r=alexcrichton

Remove superfluous `;;` sequences

Per @Mark-Simulacrum's request in https://github.com/rust-lang/rust/pull/42215#issuecomment-303908683

7 years agoRemove superfluous `;;` sequences
Dan Callahan [Thu, 25 May 2017 03:01:02 +0000 (22:01 -0500)]
Remove superfluous `;;` sequences

7 years agoMerge branch 'master' of https://github.com/jluner/cargo
jluner [Thu, 25 May 2017 02:15:22 +0000 (21:15 -0500)]
Merge branch 'master' of https://github.com/jluner/cargo

7 years agoAdd error-chain errors
jluner [Wed, 24 May 2017 04:35:54 +0000 (23:35 -0500)]
Add error-chain errors

Convert CargoResult, CargoError into an implementation provided by error-chain. The previous is_human machinery is mostly removed; now errors are displayed unless of the Internal kind, verbose mode will print all errors.

7 years agoAuto merge of #4088 - Nemikolh:buildscript-stderr, r=alexcrichton
bors [Wed, 24 May 2017 15:46:58 +0000 (15:46 +0000)]
Auto merge of #4088 - Nemikolh:buildscript-stderr, r=alexcrichton

Write stderr output from build-scripts next to stdout output

Closes #3462.

Please let me know if you want to change the file name for the error output. I originally thought that `stdout` and `stderr` would have been nice but I'm worried that changing `output` to `stdout` would cause breakage. So I choose the more conservative route.

7 years agoAdd error-chain errors
jluner [Wed, 24 May 2017 04:35:54 +0000 (23:35 -0500)]
Add error-chain errors

Convert CargoResult, CargoError into an implementation provided by error-chain. The previous is_human machinery is mostly removed; now errors are displayed unless of the Internal kind, verbose mode will print all errors.

7 years agoMention the stderr file in the documentation.
Nemikolh [Tue, 23 May 2017 17:06:43 +0000 (18:06 +0100)]
Mention the stderr file in the documentation.

7 years agoWrite stderr output from build-scripts to disk.
Nemikolh [Tue, 23 May 2017 16:21:40 +0000 (17:21 +0100)]
Write stderr output from build-scripts to disk.

Closes #3462

7 years agoAuto merge of #4085 - alexcrichton:fix-rewrite, r=matklad
bors [Mon, 22 May 2017 20:18:03 +0000 (20:18 +0000)]
Auto merge of #4085 - alexcrichton:fix-rewrite, r=matklad

Fix a serialization error on publish

In TOML we have to emit all keys before we emit all sub-tables, so to handle
that for dependencies just transform everything to an elaborated version.

Closes #4081

7 years agoFix a serialization error on publish
Alex Crichton [Mon, 22 May 2017 15:56:27 +0000 (08:56 -0700)]
Fix a serialization error on publish

In TOML we have to emit all keys before we emit all sub-tables, so to handle
that for dependencies just transform everything to an elaborated version.

Closes #4081

7 years agoAuto merge of #4084 - shiver:issue-3360, r=alexcrichton
bors [Mon, 22 May 2017 15:30:03 +0000 (15:30 +0000)]
Auto merge of #4084 - shiver:issue-3360, r=alexcrichton

3360 - Allow for features to be either comma or space delimited.

This is my attempt at tackling issue #3360.
Hopefully I interpreted the original request correctly and this is what you were looking for.

Any suggestions you might have to improve the submission would be great.
Thanks!

7 years ago3360 - Allow for features to be either comma or space delimited.
Robert Vally [Mon, 22 May 2017 13:14:03 +0000 (21:14 +0800)]
3360 - Allow for features to be either comma or space delimited.

7 years agoAuto merge of #3937 - andwur:rustc-flag-determinism, r=alexcrichton
bors [Thu, 18 May 2017 19:05:20 +0000 (19:05 +0000)]
Auto merge of #3937 - andwur:rustc-flag-determinism, r=alexcrichton

Deterministic -L and --cfg flag ordering

This ensures that the `-L` and `--cfg` flags passed to `rustc` have stable ordering across runs.

It also does the same for `--cfg` flags passed to `rustdoc`.

Fixes #3895

7 years agoOnly sort deps in build script dependency generation
Alex Crichton [Tue, 16 May 2017 15:11:23 +0000 (08:11 -0700)]
Only sort deps in build script dependency generation

7 years agoAuto merge of #4069 - alexcrichton:remove-unused-dep, r=alexcrichton
bors [Thu, 18 May 2017 16:02:59 +0000 (16:02 +0000)]
Auto merge of #4069 - alexcrichton:remove-unused-dep, r=alexcrichton

Remove chrono as a dependency

Turns out we don't use it!

7 years agoRemove chrono as a dependency
Alex Crichton [Thu, 18 May 2017 16:01:35 +0000 (09:01 -0700)]
Remove chrono as a dependency

Turns out we don't use it!

7 years agoAuto merge of #4030 - alexcrichton:rewrite-cargo-toml, r=matklad
bors [Thu, 18 May 2017 09:34:53 +0000 (09:34 +0000)]
Auto merge of #4030 - alexcrichton:rewrite-cargo-toml, r=matklad

Rewrite Cargo.toml when packaging crates

This commit is an implementation of rewriting TOML manifests when we publish
them to the registry. The rationale for doing this is to provide a guarantee
that downloaded tarballs from crates.io can be built with `cargo build`
(literally). This in turn eases a number of other possible consumers of crates
from crates.io

* Vendored sources can now be more easily modified/checked as cargo build should
  work and they're standalone crates that suffice for `path` dependencies
* Tools like cargobomb/crater no longer need to edit the manifest and can
  instead perform regression testing on the literal tarballs they download
* Other systems such as packaging Rust code may be able to take advantage of
  this, but this is a less clear benefit.

Overall I'm hesitatnt about this, unfortunately. This is a silent translation
happening on *publish*, a rare operation, that's difficult to inspect before it
flies up to crates.io. I wrote a script to run this transformation over all
crates.io crates and found a surprisingly large number of discrepancies. The
transformation basically just downloaded all crates at all versions,
regenerated the manifest, and then tested if the two manifests were (in memory)
the same.

Unfortunately historical Cargo had a critical bug which I think made this
exercise not too useful. Cargo used to *not* recreate tarballs if one already
existed, which I believe led to situations such as:

1. `cargo publish`
2. Cargo generates an error about a dependency. This could be that there's a
   `version` not present in a `path` dependency, there could be a `git`
   dependency, etc.
3. Errors are fixed.
4. `cargo publish`
5. Publish is successful

In step 4 above historical Cargo *would not recreate the tarball*. This means
that the contents of the index (what was published) aren't guaranteed to match
with the tarball's `Cargo.toml`. When building from crates.io this is ok as the
index is the source of truth for dependency information, but it means that *any*
transformation to rewrite Cargo.toml is impossible to verify against all crates
on crates.io (due to historical bugs like these).

I strove to read as many errors as possible regardless, attempting to suss out
bugs in the implementation here. To further guard against surprises I've updated
the verification step of packaging to work "normally" in these sense that it's
not rewriting dependencies itself or changing summaries. I'm hoping that this
serves as a good last-ditch effort that what we're about to publish will indeed
build as expected when uploaded to crates.io

Overall I'm probably 70% confident in this change. I think it's necessary to
make progress, but I think there are going to be very painful bugs that arise
from this feature. I'm open to ideas to help weed out these bugs ahead of time!
I've done what I can but I fear it may not be entirely enough.

Closes #4027

7 years agoRewrite Cargo.toml when packaging crates
Alex Crichton [Thu, 11 May 2017 05:09:44 +0000 (22:09 -0700)]
Rewrite Cargo.toml when packaging crates

This commit is an implementation of rewriting TOML manifests when we publish
them to the registry. The rationale for doing this is to provide a guarantee
that downloaded tarballs from crates.io can be built with `cargo build`
(literally). This in turn eases a number of other possible consumers of crates
from crates.io

* Vendored sources can now be more easily modified/checked as cargo build should
  work and they're standalone crates that suffice for `path` dependencies
* Tools like cargobomb/crater no longer need to edit the manifest and can
  instead perform regression testing on the literal tarballs they download
* Other systems such as packaging Rust code may be able to take advantage of
  this, but this is a less clear benefit.

Overall I'm hesitatnt about this, unfortunately. This is a silent translation
happening on *publish*, a rare operation, that's difficult to inspect before it
flies up to crates.io. I wrote a script to run this transformation over all
crates.io crates and found a surprisingly large number of discrepancies. The
transformation basically just downloaded all crates at all versions,
regenerated the manifest, and then tested if the two manifests were (in memory)
the same.

Unfortunately historical Cargo had a critical bug which I think made this
exercise not too useful. Cargo used to *not* recreate tarballs if one already
existed, which I believe led to situations such as:

1. `cargo publish`
2. Cargo generates an error about a dependency. This could be that there's a
   `version` not present in a `path` dependency, there could be a `git`
   dependency, etc.
3. Errors are fixed.
4. `cargo publish`
5. Publish is successful

In step 4 above historical Cargo *would not recreate the tarball*. This means
that the contents of the index (what was published) aren't guaranteed to match
with the tarball's `Cargo.toml`. When building from crates.io this is ok as the
index is the source of truth for dependency information, but it means that *any*
transformation to rewrite Cargo.toml is impossible to verify against all crates
on crates.io (due to historical bugs like these).

I strove to read as many errors as possible regardless, attempting to suss out
bugs in the implementation here. To further guard against surprises I've updated
the verification step of packaging to work "normally" in these sense that it's
not rewriting dependencies itself or changing summaries. I'm hoping that this
serves as a good last-ditch effort that what we're about to publish will indeed
build as expected when uploaded to crates.io

Overall I'm probably 70% confident in this change. I think it's necessary to
make progress, but I think there are going to be very painful bugs that arise
from this feature. I'm open to ideas to help weed out these bugs ahead of time!
I've done what I can but I fear it may not be entirely enough.

Closes #4027

7 years agoAuto merge of #4065 - michaelwoerister:smarter-cargo-incremental, r=alexcrichton
bors [Wed, 17 May 2017 13:54:21 +0000 (13:54 +0000)]
Auto merge of #4065 - michaelwoerister:smarter-cargo-incremental, r=alexcrichton

Only compile user-modifiable projects incrementally.

Fixes #3972. Thanks for pointing me to the correct implementation, Alex!

r? @alexcrichton

7 years agoOnly compile user-modifiable projects incrementally.
Michael Woerister [Wed, 17 May 2017 12:14:41 +0000 (14:14 +0200)]
Only compile user-modifiable projects incrementally.

7 years agoAuto merge of #4060 - alexcrichton:nobare, r=matklad
bors [Wed, 17 May 2017 01:33:51 +0000 (01:33 +0000)]
Auto merge of #4060 - alexcrichton:nobare, r=matklad

Don't use a bare checkout of the index

Both old and new Cargo share the same index, so be sure to maintain
compatibility by initializing a non-bare repository for the index. Note that
a nightly Cargo still won't check out the index, but when an older Cargo comes
along and tries to check it out then it'll work.

Closes #4058

7 years agoAuto merge of #4055 - mersinvald:less-strict-libtest-tests, r=alexcrichton
bors [Tue, 16 May 2017 23:44:37 +0000 (23:44 +0000)]
Auto merge of #4055 - mersinvald:less-strict-libtest-tests, r=alexcrichton

Making tests less strict so they won't break on output changes

Required for https://github.com/rust-lang/rust/pull/41910

cc @Mark-Simulacrum
cc @alexcrichton

7 years agoAuto merge of #3979 - hjr3:issue-3911, r=alexcrichton
bors [Tue, 16 May 2017 22:16:09 +0000 (22:16 +0000)]
Auto merge of #3979 - hjr3:issue-3911, r=alexcrichton

Support glob syntax in workspace members

Fixes #3911

7 years agoDon't use a bare checkout of the index
Alex Crichton [Tue, 16 May 2017 14:07:36 +0000 (07:07 -0700)]
Don't use a bare checkout of the index

Both old and new Cargo share the same index, so be sure to maintain
compatibility by initializing a non-bare repository for the index. Note that
a nightly Cargo still won't check out the index, but when an older Cargo comes
along and tries to check it out then it'll work.

Closes #4058

7 years agoAdd test case for non-deterministic --cfg flags passed to rustc
Andrew Watts [Fri, 21 Apr 2017 06:17:52 +0000 (15:47 +0930)]
Add test case for non-deterministic --cfg flags passed to rustc

7 years agoFix non-deterministic --cfg feature flag list generation
Andrew Watts [Fri, 21 Apr 2017 06:11:01 +0000 (15:41 +0930)]
Fix non-deterministic --cfg feature flag list generation

The resolved features were returned in a HashSet and then iterated over,
which returns the feature names in arbitrary order.

See #3895

7 years agoAdd test case for non-deterministic rustc flags due to dependencies
Andrew Watts [Fri, 21 Apr 2017 02:36:32 +0000 (12:06 +0930)]
Add test case for non-deterministic rustc flags due to dependencies

7 years agoFix non-deterministic unit dependency list generation
Andrew Watts [Fri, 21 Apr 2017 01:24:47 +0000 (10:54 +0930)]
Fix non-deterministic unit dependency list generation

This resulted in the flags passed to rustc having random
ordering, see #3895.

7 years agoUse a few more `chain_error` calls
Alex Crichton [Tue, 16 May 2017 15:03:36 +0000 (08:03 -0700)]
Use a few more `chain_error` calls

7 years agoMerge branch 'master' into less-strict-libtest-tests
Mike Lubinets [Tue, 16 May 2017 13:32:56 +0000 (16:32 +0300)]
Merge branch 'master' into less-strict-libtest-tests

7 years agoAuto merge of #4057 - jtojnar:patch-1, r=matklad
bors [Tue, 16 May 2017 11:35:48 +0000 (11:35 +0000)]
Auto merge of #4057 - jtojnar:patch-1, r=matklad

Update link in manifest documentation

7 years agoUpdate link in manifest documentation
Jan Tojnar [Tue, 16 May 2017 10:51:47 +0000 (12:51 +0200)]
Update link in manifest documentation

7 years agoLess strict tests regarding libtest's stdout
Mike Lubinets [Tue, 16 May 2017 02:13:43 +0000 (05:13 +0300)]
Less strict tests regarding libtest's stdout

7 years agoAuto merge of #4051 - alexcrichton:fix-flaky-test, r=alexcrichton
bors [Tue, 16 May 2017 01:16:03 +0000 (01:16 +0000)]
Auto merge of #4051 - alexcrichton:fix-flaky-test, r=alexcrichton

Fix a flaky concurrent test with correct locking

The recent refactoring to clone the bare registry left in an accidental path
where index checkouts could clobber one another. This commit updates the logic
with proper locking and attempt ordering, attempting a full retry of the open
operation after the index locked.

7 years agoAuto merge of #4050 - eminence:help_jobs_text, r=alexcrichton
bors [Mon, 15 May 2017 23:29:58 +0000 (23:29 +0000)]
Auto merge of #4050 - eminence:help_jobs_text, r=alexcrichton

Reword the `cargo test --help` text about the --jobs argument

This should reduce confusion about what the --jobs argument does and how
to control the number of simultaneous running test cases.

Closes #4045

7 years agoAuto merge of #4046 - jmatraszek:fix_rust_41797, r=alexcrichton
bors [Mon, 15 May 2017 20:28:27 +0000 (20:28 +0000)]
Auto merge of #4046 - jmatraszek:fix_rust_41797, r=alexcrichton

Change inferring bin's name logic

Should fix rust-lang/rust#41797.

7 years agoFix a flaky concurrent test with correct locking
Alex Crichton [Mon, 15 May 2017 19:09:16 +0000 (12:09 -0700)]
Fix a flaky concurrent test with correct locking

The recent refactoring to clone the bare registry left in an accidental path
where index checkouts could clobber one another. This commit updates the logic
with proper locking and attempt ordering, attempting a full retry of the open
operation after the index locked.

7 years agoAuto merge of #3929 - Xion:master, r=alexcrichton
bors [Mon, 15 May 2017 18:34:40 +0000 (18:34 +0000)]
Auto merge of #3929 - Xion:master, r=alexcrichton

Allow cargo:rustc-env in build scripts

This is an attempt to address issue #2875. Basically, I'm trying to allow build scripts to produce`cargo:rustc-env=FOO=foo` lines in their output. These are then translated to `env!()`-friendly env. vars that rustc is run with.

7 years agoAuto merge of #4043 - alexcrichton:fix-flaky-test, r=alexcrichton
bors [Mon, 15 May 2017 16:12:09 +0000 (16:12 +0000)]
Auto merge of #4043 - alexcrichton:fix-flaky-test, r=alexcrichton

Don't try to reach example.com in a test

Instead specify localhost

7 years agoDon't try to reach example.com in a test
Alex Crichton [Sun, 14 May 2017 17:36:01 +0000 (10:36 -0700)]
Don't try to reach example.com in a test

Instead specify localhost

7 years agoReword the `cargo test --help` text about the --jobs argument
Andrew Chin [Mon, 15 May 2017 14:40:36 +0000 (10:40 -0400)]
Reword the `cargo test --help` text about the --jobs argument

This should reduce confusion about what the --jobs argument does and how
to control the number of simultaneous running test cases.

Closes #4045

7 years agoAuto merge of #4047 - boxofrox:update-bin-docs, r=alexcrichton
bors [Mon, 15 May 2017 14:08:19 +0000 (14:08 +0000)]
Auto merge of #4047 - boxofrox:update-bin-docs, r=alexcrichton

Update docs: cargo does not build src/bin/*.rs when toml contains [[bin]

Update docs per #4013.

Does it make sense to also mention this behavior in the [Configuring a target](http://doc.crates.io/manifest.html#configuring-a-target) section?

7 years agoUpdate documentation: cargo does not build src/bin/*.rs when toml contains [[bin]]
Justin Charette [Sun, 14 May 2017 21:33:33 +0000 (17:33 -0400)]
Update documentation: cargo does not build src/bin/*.rs when toml contains [[bin]]

Signed-off-by: Justin Charette <charetjc@gmail.com>
7 years agoChange inferring bin's name logic
Jakub Matraszek [Sun, 14 May 2017 20:47:24 +0000 (22:47 +0200)]
Change inferring bin's name logic

7 years agoAuto merge of #3954 - RReverser:run-with, r=alexcrichton
bors [Sat, 13 May 2017 18:06:26 +0000 (18:06 +0000)]
Auto merge of #3954 - RReverser:run-with, r=alexcrichton

Add support for custom target-specific runners

When `target.$triple.runner` is specified, it will be used for any execution commands by cargo including `cargo run`, `cargo test` and `cargo bench`. The original file is passed to the runner executable as a first argument.

This allows to run tests when cross-comping Rust projects.

This is not a complete solution and might be extended in future for better ergonomics to support passing extra arguments to the runner itself or overriding runner from the command line, but it should already unlock major existing use cases.

Fixes #1411
Resolves #3626

7 years agoUpdating doc to reflect new badges added
Nisarg Thakkar [Sat, 13 May 2017 17:59:25 +0000 (23:29 +0530)]
Updating doc to reflect new badges added

7 years agoDocument the feature
Karol Kuczmarski [Sat, 13 May 2017 16:00:52 +0000 (17:00 +0100)]
Document the feature

7 years agoFix build script envvars for `cargo test/doc`
Karol Kuczmarski [Sat, 13 May 2017 15:51:40 +0000 (16:51 +0100)]
Fix build script envvars for `cargo test/doc`

7 years agoFix tidy error
Ingvar Stepanyan [Sat, 13 May 2017 10:36:53 +0000 (11:36 +0100)]
Fix tidy error

7 years agoAllow runner params
Ingvar Stepanyan [Fri, 12 May 2017 22:07:42 +0000 (23:07 +0100)]
Allow runner params

7 years agoAdd documentation about target.$triple.runner
Ingvar Stepanyan [Wed, 26 Apr 2017 00:32:20 +0000 (01:32 +0100)]
Add documentation about target.$triple.runner

7 years agoAdd support for custom target-specific runners
Ingvar Stepanyan [Wed, 26 Apr 2017 00:16:17 +0000 (01:16 +0100)]
Add support for custom target-specific runners

When `target.$triple.runner` is specified, it will be used for any execution commands by cargo including `cargo run`, `cargo test` and `cargo bench`. The original file is passed to the runner executable as a first argument.

This allows to run tests when cross-comping Rust projects.

This is not a complete solution, and might be extended in future for better ergonomics to support passing extra arguments to the runner itself or overriding runner from command line, but it should already unlock major existing usecases.

Fixes #1411
Resolves #3626

7 years agoFix PR comments
Karol Kuczmarski [Fri, 12 May 2017 20:47:28 +0000 (21:47 +0100)]
Fix PR comments

7 years agoAllow cargo:rustc-env in build scripts
Karol Kuczmarski [Mon, 17 Apr 2017 18:48:56 +0000 (19:48 +0100)]
Allow cargo:rustc-env in build scripts

7 years agoAuto merge of #4033 - integer32llc:fix-sys-docs, r=alexcrichton
bors [Fri, 12 May 2017 05:11:06 +0000 (05:11 +0000)]
Auto merge of #4033 - integer32llc:fix-sys-docs, r=alexcrichton

Clear up Linking to Systems Libraries docs

Fixes #2191.

7 years agoClear up Linking to Systems Libraries docs
Carol (Nichols || Goulding) [Fri, 12 May 2017 01:39:36 +0000 (21:39 -0400)]
Clear up Linking to Systems Libraries docs

Fixes #2191.

7 years agoAuto merge of #4026 - alexcrichton:bare-registry, r=matklad
bors [Thu, 11 May 2017 22:05:55 +0000 (22:05 +0000)]
Auto merge of #4026 - alexcrichton:bare-registry, r=matklad

Don't check out the crates.io index locally

This commit moves working with the crates.io index to operating on the git
object layers rather than actually literally checking out the index. This is
aimed at two different goals:

* Improving the on-disk file size of the registry
* Improving cloning times for the registry as the index doesn't need to be
  checked out

The on disk size of my `registry` folder of a fresh check out of the index went
form 124M to 48M, saving a good chunk of space! The entire operation took about
0.6s less on a Unix machine (out of 4.7s total for current Cargo). On Windows,
however, the clone operation went from 11s to 6.7s, a much larger improvement!

Closes #4015

7 years agoDon't check out the crates.io index locally
Alex Crichton [Wed, 10 May 2017 22:00:33 +0000 (15:00 -0700)]
Don't check out the crates.io index locally

This commit moves working with the crates.io index to operating on the git
object layers rather than actually literally checking out the index. This is
aimed at two different goals:

* Improving the on-disk file size of the registry
* Improving cloning times for the registry as the index doesn't need to be
  checked out

The on disk size of my `registry` folder of a fresh check out of the index went
form 124M to 48M, saving a good chunk of space! The entire operation took about
0.6s less on a Unix machine (out of 4.7s total for current Cargo). On Windows,
however, the clone operation went from 11s to 6.7s, a much larger improvement!

Closes #4015