]> git.proxmox.com Git - cargo.git/log
cargo.git
4 years agoAvoid buffering large amounts of rustc output.
Eric Huss [Sun, 8 Mar 2020 03:58:37 +0000 (19:58 -0800)]
Avoid buffering large amounts of rustc output.

4 years agoReplace `std::sync::mpsc` with a much simpler queue
Alex Crichton [Wed, 29 Jan 2020 08:21:19 +0000 (00:21 -0800)]
Replace `std::sync::mpsc` with a much simpler queue

We don't need the complexity of most channels since this is not a
performance sensitive part of Cargo, nor is it likely to be so any time
soon. Coupled with recent bugs (#7840) we believe in `std::sync::mpsc`,
let's just not use that and use a custom queue type locally which should
be amenable to a blocking push soon too.

4 years agoAuto merge of #7965 - jiegec:master, r=alexcrichton
bors [Thu, 5 Mar 2020 23:02:29 +0000 (23:02 +0000)]
Auto merge of #7965 - jiegec:master, r=alexcrichton

Don't create hardlink for library test and integrations tests, fixing #7960

Related issue: #7960

Problem:

Tests are run under deps, but it is still copied to its parent directory. It leads to separation between the executable and its debug symbols (.dSYM directory).

Solution:

Set hardlink to None.

4 years agoAuto merge of #7970 - ehuss:revert-debug-assert-filter, r=alexcrichton
bors [Thu, 5 Mar 2020 17:09:08 +0000 (17:09 +0000)]
Auto merge of #7970 - ehuss:revert-debug-assert-filter, r=alexcrichton

Partially revert change to filter debug_assertions.

This partially reverts the changes from #7943. It caused a regression with the rocket_contrib crate. I knew that was the only crate that had a `cfg(debug_assertions)` dependency, and I saw that it had been fixed, but I did not realize the fix hadn't been published (and will be in a semver incompatible release).

This retains the old behavior for `cfg(debug_assertions)` of issuing a warning. I kept the filter for `CARGO_CFG_DEBUG_ASSERTIONS` for build scripts because that was the original intent for the change, and I don't see anyone using that.

Closes #7966.

4 years agoPartially revert change to filter debug_assertions.
Eric Huss [Thu, 5 Mar 2020 16:20:52 +0000 (08:20 -0800)]
Partially revert change to filter debug_assertions.

4 years agoDon't create hardlink for library test, integrations tests and benches, fixing #7960
Jiajie Chen [Wed, 4 Mar 2020 10:12:21 +0000 (18:12 +0800)]
Don't create hardlink for library test, integrations tests and benches, fixing #7960

4 years agoAuto merge of #7959 - ehuss:restricted-crate-names, r=alexcrichton
bors [Wed, 4 Mar 2020 15:37:33 +0000 (15:37 +0000)]
Auto merge of #7959 - ehuss:restricted-crate-names, r=alexcrichton

Try to better handle restricted crate names.

This attempts to improve handling of restricted crate names, particularly for `cargo new` and `cargo init`. Hopefully the code is straightforward to follow, but in summary the changes are:

**General changes**

* Add more details to the error messages about why a name is not allowed, and what is allowed.
* Change the valid package name check to be restricted to Unicode XID. This brings it in line with non_ascii_idents support in rustc. For the most part, this is pretty much the same as before. Note: this is used for the package name, and registry names. The differences are:
    * Package names cannot start with numbers. Previously this was only rejected in `cargo new`. crates.io also rejects numbers. Numbers are also not valid crate names.
    * Package names cannot start with dash `-`. This is a somewhat arbitrary change, but seems like it would stem problems. crates.io also rejects this.
    * Package names cannot start with these characters that were previously allowed: https://gist.github.com/ehuss/804a797950001b5226e1264b6f65211f#file-not_start_but_alphanumeric-txt
        * Most of these are wacky numbers or other strange things.
    * Package names cannot contain these characters that were previously allowed: https://gist.github.com/ehuss/804a797950001b5226e1264b6f65211f#file-not_continue_but_alphanumeric-txt
        * These are mostly odd things that for whatever reason the Unicode people decided not to include. It seems unlikely to me that someone would want to use one of these.
* Display a warning on Windows if a Cargo target is a special Windows filename. The build error tends to be hard to understand, so the hope is the warning will make it evident.
* `cargo package/publish`: Warn if a special Windows name is in the package.

**cargo new/init specific changes**

* Update keyword list to 2018 edition.
* Add warning if creating a library that has one of the conflicting names (deps/examples/build/incremental).
* Warn about conflicting std names (core/std/alloc/proc-macro).
* Windows reserved names: Rejected on windows, warned on other platforms.
* Warn about non-ASCII package names.
* Only print the `--name` suggestion for `cargo init`. I found the suggestion confusing, and I feel like it doesn't really make sense for `cargo new` (since it would only affect the directory name).

4 years agoAuto merge of #7962 - ehuss:features2-required-feature-inactive, r=alexcrichton
bors [Tue, 3 Mar 2020 20:17:11 +0000 (20:17 +0000)]
Auto merge of #7962 - ehuss:features2-required-feature-inactive, r=alexcrichton

Fix bug with new feature resolver and required-features.

If required-features are used, then the code for checking those features would crash if a dependency was not activated.  The solution here is to not be strict about only requesting activated packages.

For context, the reason this can panic is to check for any bugs in the resolver or places that make bad assumptions.  I missed this particular case, though.

4 years agoFix bug with new feature resolver and required-features.
Eric Huss [Tue, 3 Mar 2020 19:46:37 +0000 (11:46 -0800)]
Fix bug with new feature resolver and required-features.

4 years agoWarn when packaging files with Windows special names.
Eric Huss [Tue, 3 Mar 2020 00:14:36 +0000 (16:14 -0800)]
Warn when packaging files with Windows special names.

4 years agoWarn on Windows about reserved target names.
Eric Huss [Mon, 2 Mar 2020 22:47:38 +0000 (14:47 -0800)]
Warn on Windows about reserved target names.

4 years agoTry to better handle restricted crate names.
Eric Huss [Mon, 2 Mar 2020 22:26:21 +0000 (14:26 -0800)]
Try to better handle restricted crate names.

4 years agoAuto merge of #7956 - ehuss:fix-collision-test, r=alexcrichton
bors [Mon, 2 Mar 2020 18:05:34 +0000 (18:05 +0000)]
Auto merge of #7956 - ehuss:fix-collision-test, r=alexcrichton

Fix rare failure in collision_export test.

Seen once on CI in #7952 (https://dev.azure.com/rust-lang/cargo/_build/results?buildId=22112&view=logs&j=a5e52b91-c83f-5429-4a68-c246fc63a4f7&t=d4864165-4be3-5e34-b483-a6b05303aa68). I was able to reproduce it locally, though it is rare. There seems to be some kind of race issue on macOS with two processes trying to symlink the same directory at the same time. The solution is to serialize the build so they don't run at the same time.

4 years agoFix rare failure in collision_export test.
Eric Huss [Mon, 2 Mar 2020 17:46:39 +0000 (09:46 -0800)]
Fix rare failure in collision_export test.

4 years agoAuto merge of #7947 - quark-zju:ignore-broken-git, r=ehuss
bors [Mon, 2 Mar 2020 17:38:11 +0000 (17:38 +0000)]
Auto merge of #7947 - quark-zju:ignore-broken-git, r=ehuss

Ignore broken Cargo.toml in git sources

Commit 3d6de4177489a5d450f35e92288512be85492678 (#3998) made cargo
ignore Cargo.toml files that are invalid TOML in a git source.
This change further ignores Cargo.toml files that are valid TOML but
cannot really be loaded in a git source.

This is potentially an alternative fix for #6822.

4 years agoAuto merge of #7952 - ehuss:fingerprint-mtime-debug-extra, r=alexcrichton
bors [Mon, 2 Mar 2020 17:21:22 +0000 (17:21 +0000)]
Auto merge of #7952 - ehuss:fingerprint-mtime-debug-extra, r=alexcrichton

Add more fingerprint mtime debug logging.

Adding some more debug logging on top of #7888.

There was a mistake in the original PR, where `dep.pkg_id` should have been `dep.name`.

4 years agoAuto merge of #7955 - ehuss:fix-plugin-syntax-rename, r=alexcrichton
bors [Mon, 2 Mar 2020 16:54:53 +0000 (16:54 +0000)]
Auto merge of #7955 - ehuss:fix-plugin-syntax-rename, r=alexcrichton

Fix plugin tests for latest nightly.

Crate was renamed in https://github.com/rust-lang/rust/pull/69592.

4 years agoFix plugin tests for latest nightly.
Eric Huss [Mon, 2 Mar 2020 16:52:30 +0000 (08:52 -0800)]
Fix plugin tests for latest nightly.

4 years agoAdd more fingerprint mtime debug logging.
Eric Huss [Sat, 29 Feb 2020 18:56:34 +0000 (10:56 -0800)]
Add more fingerprint mtime debug logging.

4 years agoIgnore broken Cargo.toml in git sources
Jun Wu [Fri, 28 Feb 2020 23:52:19 +0000 (15:52 -0800)]
Ignore broken Cargo.toml in git sources

Commit 3d6de4177489a5d450f35e92288512be85492678 (#3998) made cargo
ignore Cargo.toml files that are invalid TOML in a git source.
This change further ignores Cargo.toml files that are valid TOML but
cannot really be loaded.

This is potentially an alternative fix for #6822.

4 years agoAuto merge of #7945 - hbina:small_change_to_siphasher, r=alexcrichton
bors [Fri, 28 Feb 2020 19:16:36 +0000 (19:16 +0000)]
Auto merge of #7945 - hbina:small_change_to_siphasher, r=alexcrichton

Simplified usage code of SipHasher

SipHasher::new_with_keys(0,0) is just a longer version of just _::new()
i.e. the latter is an alias for the former.

Just a bit of a nothing burger I noticed while debugging some other issue.

4 years agoAuto merge of #7944 - aleksator:7469_git_config_discovery, r=ehuss
bors [Fri, 28 Feb 2020 18:52:43 +0000 (18:52 +0000)]
Auto merge of #7944 - aleksator:7469_git_config_discovery, r=ehuss

Add a special case for git config discovery inside tests

Fixes #7469: Some tests will fail if one have a local git config user.name/user.email

4 years agoAuto merge of #7946 - hbina:add_stream_hashu64, r=alexcrichton
bors [Fri, 28 Feb 2020 18:35:27 +0000 (18:35 +0000)]
Auto merge of #7946 - hbina:add_stream_hashu64, r=alexcrichton

Fixes issue #7543

Added a helper function for `util::hex::hash_64` that uses streams
the content instead of reading through the entire content in one
go.

Edit: Should I add test cases for this?

Edit2: Per #7543

4 years agoAdd a special case for git config discovery inside tests
Alex Tokarev [Thu, 27 Feb 2020 16:34:16 +0000 (19:34 +0300)]
Add a special case for git config discovery inside tests

Fixes #7469: Some tests will fail if one have a local git config user.name/user.email

4 years agohash_u64_file now returns an Error instead of panicking.
Hanif Bin Ariffin [Thu, 27 Feb 2020 22:30:19 +0000 (17:30 -0500)]
hash_u64_file now returns an Error instead of panicking.

4 years agoFix erronous error with call to write
Hanif Bin Ariffin [Thu, 27 Feb 2020 22:14:24 +0000 (17:14 -0500)]
Fix erronous error with call to write

4 years agoFixes issue #7543
Hanif Bin Ariffin [Thu, 27 Feb 2020 21:44:50 +0000 (16:44 -0500)]
Fixes issue #7543

Added a helper function for util::hex::hash_64 that uses streams
the content instead of reading through the entire content in one
go.

4 years agoSimplified usage code of SipHasher
Hanif Bin Ariffin [Thu, 27 Feb 2020 19:16:05 +0000 (14:16 -0500)]
Simplified usage code of SipHasher

SipHasher::new_with_keys(0,0) is just a longer version of just _::new()
i.e. the latter is an alias for the former.

4 years agoAuto merge of #7943 - aleksator:7933_cargo_cfgs, r=ehuss
bors [Thu, 27 Feb 2020 17:12:21 +0000 (17:12 +0000)]
Auto merge of #7943 - aleksator:7933_cargo_cfgs, r=ehuss

Filter out cfgs which should not be used during build

Fixes #7933: Filter invalid CARGO_CFG_ in build scripts

4 years agoAuto merge of #7934 - ehuss:query-error-context, r=Eh2406
bors [Thu, 27 Feb 2020 16:37:10 +0000 (16:37 +0000)]
Auto merge of #7934 - ehuss:query-error-context, r=Eh2406

Provide extra context on a query failure.

This adds error context when a query fails, primarily to tell you which parent package included the dependency that failed. For example, imagine deep within your dependency graph you have a `git` dependency, and it fails to download. The current error doesn't tell you where in the graph that `git` dependency was included.

I also slightly tweaked the `failed to load source` error message. I felt like the existing wording could be misinterpreted that it was an error loading the dependency *for* the given package. I felt like there were multiple ways to interpret it, so I tried to simplify it to avoid that possibility.

4 years agoAdd path to the failure to load a dependency.
Eric Huss [Thu, 27 Feb 2020 16:17:18 +0000 (08:17 -0800)]
Add path to the failure to load a dependency.

4 years agoFilter out cfgs which should not be used during build
Alex Tokarev [Tue, 25 Feb 2020 18:28:36 +0000 (21:28 +0300)]
Filter out cfgs which should not be used during build

Fixes #7933: Filter invalid CARGO_CFG_ in build scripts

4 years agoAuto merge of #7927 - ehuss:metadata-docs-clarify, r=alexcrichton
bors [Wed, 26 Feb 2020 21:00:00 +0000 (21:00 +0000)]
Auto merge of #7927 - ehuss:metadata-docs-clarify, r=alexcrichton

Try to clarify `cargo metadata`'s relationship with the workspace.

Closes #7893

4 years agoAuto merge of #7939 - alexcrichton:update-libgit2, r=Eh2406
bors [Wed, 26 Feb 2020 18:02:06 +0000 (18:02 +0000)]
Auto merge of #7939 - alexcrichton:update-libgit2, r=Eh2406

Update libgit2 dependency

Brings in a few CVE fixes and such for libgit2, bringing libgit to
0.99.0

4 years agoUpdate libgit2 dependency
Alex Crichton [Wed, 26 Feb 2020 17:39:05 +0000 (09:39 -0800)]
Update libgit2 dependency

Brings in a few CVE fixes and such for libgit2, bringing libgit to
0.99.0

4 years agoAuto merge of #7936 - giraffate:fix_link, r=alexcrichton
bors [Wed, 26 Feb 2020 05:22:50 +0000 (05:22 +0000)]
Auto merge of #7936 - giraffate:fix_link, r=alexcrichton

Fix link in comment

https://doc.rust-lang.org/grammar.html#keywords seems to move to https://doc.rust-lang.org/reference/keywords.html.

4 years agoFix link in comment
Takayuki Nakata [Wed, 26 Feb 2020 02:16:55 +0000 (11:16 +0900)]
Fix link in comment

This link seems to move to https://doc.rust-lang.org/reference/keywords.html.

4 years agoAuto merge of #7932 - ehuss:enable-doc-open-macos, r=alexcrichton
bors [Tue, 25 Feb 2020 18:43:31 +0000 (18:43 +0000)]
Auto merge of #7932 - ehuss:enable-doc-open-macos, r=alexcrichton

Enable `cargo doc --open` tests on macos.

Now that #7576 is merged, these tests should work fine on macos.

4 years agoAuto merge of #7931 - ehuss:build-std-no-sysroot-probe, r=alexcrichton
bors [Tue, 25 Feb 2020 18:25:15 +0000 (18:25 +0000)]
Auto merge of #7931 - ehuss:build-std-no-sysroot-probe, r=alexcrichton

build-std: remove sysroot probe

Now that RustcTargetData is computed earlier, running `rustc` again is no longer necessary.

4 years agoProvide extra context on a query failure.
Eric Huss [Tue, 25 Feb 2020 18:17:11 +0000 (10:17 -0800)]
Provide extra context on a query failure.

4 years agoEnable `cargo doc --open` tests on macos.
Eric Huss [Tue, 25 Feb 2020 16:13:30 +0000 (08:13 -0800)]
Enable `cargo doc --open` tests on macos.

4 years agobuild-std: remove sysroot probe
Eric Huss [Tue, 25 Feb 2020 15:57:56 +0000 (07:57 -0800)]
build-std: remove sysroot probe

4 years agoAuto merge of #7928 - ehuss:features-current-doc, r=alexcrichton
bors [Tue, 25 Feb 2020 15:53:24 +0000 (15:53 +0000)]
Auto merge of #7928 - ehuss:features-current-doc, r=alexcrichton

Try to clarify how feature flags work on the "current" package.

It's a bit confusing, even with an explanation, but maybe it will help.  Hopefully some day in the future feature selection won't be so wonky.

4 years agoTry to clarify how feature flags work on the "current" package.
Eric Huss [Tue, 25 Feb 2020 02:01:30 +0000 (18:01 -0800)]
Try to clarify how feature flags work on the "current" package.

4 years agoTry to clarify `cargo metadata`'s relationship with the workspace.
Eric Huss [Tue, 25 Feb 2020 01:58:44 +0000 (17:58 -0800)]
Try to clarify `cargo metadata`'s relationship with the workspace.

4 years agoAuto merge of #7918 - ehuss:features-doc-comment, r=Eh2406
bors [Sat, 22 Feb 2020 16:07:14 +0000 (16:07 +0000)]
Auto merge of #7918 - ehuss:features-doc-comment, r=Eh2406

Add extra details in the new feature resolver doc comment.

Some extra details about how the new feature resolver fits in the picture.

4 years agoAdd extra details in the new feature resolver doc comment.
Eric Huss [Fri, 21 Feb 2020 21:16:58 +0000 (13:16 -0800)]
Add extra details in the new feature resolver doc comment.

4 years agoAuto merge of #7912 - matthiaskrgr:clippy_v11, r=ehuss
bors [Fri, 21 Feb 2020 20:20:10 +0000 (20:20 +0000)]
Auto merge of #7912 - matthiaskrgr:clippy_v11, r=ehuss

fix most remaining clippy findings (mostly redundant imports)

4 years agoAuto merge of #7917 - ehuss:features-tracking-issues, r=alexcrichton
bors [Fri, 21 Feb 2020 20:01:44 +0000 (20:01 +0000)]
Auto merge of #7917 - ehuss:features-tracking-issues, r=alexcrichton

Add -Zfeatures tracking issues.

4 years agoAuto merge of #7913 - ehuss:linkcheck-script, r=alexcrichton
bors [Fri, 21 Feb 2020 19:41:03 +0000 (19:41 +0000)]
Auto merge of #7913 - ehuss:linkcheck-script, r=alexcrichton

Use rust-lang/rust linkchecker on CI.

This can help ensure submodule updates go smoothly.

4 years agoAdd -Zfeatures tracking issues.
Eric Huss [Fri, 21 Feb 2020 19:05:28 +0000 (11:05 -0800)]
Add -Zfeatures tracking issues.

4 years agoUse rust-lang/rust linkchecker on CI.
Eric Huss [Fri, 21 Feb 2020 17:27:32 +0000 (09:27 -0800)]
Use rust-lang/rust linkchecker on CI.

4 years agofix most remaining clippy findings (mostly redundant imports)
Matthias Krüger [Fri, 21 Feb 2020 11:15:16 +0000 (12:15 +0100)]
fix most remaining clippy findings (mostly redundant imports)

4 years agoAuto merge of #7911 - aleksator:run_through_clippy, r=ehuss
bors [Fri, 21 Feb 2020 03:18:53 +0000 (03:18 +0000)]
Auto merge of #7911 - aleksator:run_through_clippy, r=ehuss

Clean up code mostly based on clippy suggestions

4 years agoAuto merge of #7903 - aleksator:1681_doc_crate_version, r=ehuss
bors [Fri, 21 Feb 2020 02:57:41 +0000 (02:57 +0000)]
Auto merge of #7903 - aleksator:1681_doc_crate_version, r=ehuss

Add an option to include crate versions to the generated docs

Fixes https://github.com/rust-lang/cargo/issues/1681

4 years agoAuto merge of #7905 - ehuss:license-file-updates, r=alexcrichton
bors [Thu, 20 Feb 2020 23:04:43 +0000 (23:04 +0000)]
Auto merge of #7905 - ehuss:license-file-updates, r=alexcrichton

Better support for license-file.

This adds some changes to how `cargo package` and `cargo publish` handle the `license-file` field. This also incorporates some refactoring which hopefully makes the code a little clearer and straightforward, but which also resulted in some minor behavior changes.

* Warn if license-file points to a non-existent file.
* Automatically include license-file, even if it is not listed in the `package.include` list (similar to how Cargo.toml/lock are automatically included).
* If license-file points outside of the package root, copy the file to the package root (and rewrite the field in Cargo.toml).
* Files are now sorted when archived.
* `Archiving: Cargo.toml.orig` is explicitly printed where before it did not report that.
* `cargo package --list` now shows `Cargo.toml.orig` where before it was not reported.

Closes #3537
Closes #7830

4 years agoRun through nightly clippy
Alex Tokarev [Thu, 20 Feb 2020 20:01:08 +0000 (23:01 +0300)]
Run through nightly clippy

4 years agoDocument unstable 'crate-versions' flag
Alex Tokarev [Thu, 20 Feb 2020 17:17:10 +0000 (20:17 +0300)]
Document unstable 'crate-versions' flag

https://github.com/rust-lang/cargo/issues/7907

4 years agoAdd an option to include crate versions to the generated docs
Alex Tokarev [Tue, 18 Feb 2020 23:11:16 +0000 (02:11 +0300)]
Add an option to include crate versions to the generated docs

Fixes https://github.com/rust-lang/cargo/issues/1681

4 years agoCopy license-file into package if outside of root.
Eric Huss [Wed, 19 Feb 2020 18:46:54 +0000 (10:46 -0800)]
Copy license-file into package if outside of root.

4 years agoAdd a warning if license-file points to a file that does not exist.
Eric Huss [Tue, 18 Feb 2020 19:40:04 +0000 (11:40 -0800)]
Add a warning if license-file points to a file that does not exist.

4 years agoRemove unused imports
Alex Tokarev [Thu, 20 Feb 2020 19:22:48 +0000 (22:22 +0300)]
Remove unused imports

4 years agoAuto merge of #7820 - ehuss:features2-split, r=alexcrichton
bors [Thu, 20 Feb 2020 20:35:44 +0000 (20:35 +0000)]
Auto merge of #7820 - ehuss:features2-split, r=alexcrichton

Add new feature resolver.

This adds a new resolver which handles feature unification independently of the main resolver. This can be enabled with the `-Zfeatures` flag which takes a comma-separated list of options to enable new behaviors. See `unstable.md` docs for details.

There are two significant behavior changes:

1. Ignore targets that are not enabled.
2. Do not unify features between build_deps, dev_deps, and normal deps.

The "forks" in the unit graph are handled by adding `DepKind` to `UnitFor`. The feature resolver tracks features independently for the different dependency kinds.

Unfortunately this currently does not support decoupling proc_macro dependencies. This is because at resolve time it does not know which dependencies are proc_macros. Moving feature resolution to after the packages are downloaded would require massive changes, and would make the unit computation much more complex. Nobody to my knowledge has requested this capability, presumably because proc_macros are relatively new, and they tend not to have very many dependencies, and those dependencies tend to be proc-macro specific (like syn/quote). I'd like to lean towards adding proc-macro to the index so that it can be known during resolve time, which would be much easier to implement, but with the downside of needing to add a new field to the index.

I did not update `cargo metadata`, yet. It's not really clear how it should behave. I think I'll need to investigate how people are currently using the feature information and figure out how it should work. Perhaps adding features to "dep_kinds" will be the solution, but I'm not sure.

The goal is to try to gather feedback about how well this new resolver works. There are two important things to check: whether it breaks a project, and how much does it increases compile time (since packages can be built multiple times with different features). I'd like to stabilize it one piece at a time assuming the disruption is not too great. If a project breaks or builds slower, the user can implement a backwards-compatible workaround of sprinkling additional features into `Cargo.toml` dependencies. I think `itarget` is a good candidate to try to stabilize first, since it is less likely to break things or change how things are built. If it does cause too much disruption, then I think we'll need to consider making it optional, enabled *somehow*.

There is an environment variable that can be set which forces Cargo to use the new feature resolver. This can be used in Cargo's own testsuite to explore which tests behave differently with the different features set.

4 years agoFix bug where an optional dependency is disabled in one fork, and enabled in another.
Eric Huss [Thu, 20 Feb 2020 19:42:53 +0000 (11:42 -0800)]
Fix bug where an optional dependency is disabled in one fork, and enabled in another.

4 years agoAdd comment on relationship of RunCustomBuild and UnitFor::host.
Eric Huss [Thu, 20 Feb 2020 17:05:17 +0000 (09:05 -0800)]
Add comment on relationship of RunCustomBuild and UnitFor::host.

4 years agoAdd comment trying to explain recursion and optional dependencies.
Eric Huss [Thu, 20 Feb 2020 16:56:41 +0000 (08:56 -0800)]
Add comment trying to explain recursion and optional dependencies.

4 years agoTry to clarify some things about UnitFor build flags.
Eric Huss [Wed, 19 Feb 2020 23:58:20 +0000 (15:58 -0800)]
Try to clarify some things about UnitFor build flags.

4 years agoTry to remove some rightwards drift.
Eric Huss [Wed, 19 Feb 2020 23:45:42 +0000 (15:45 -0800)]
Try to remove some rightwards drift.

4 years agoCompute dep_for_build in one place.
Eric Huss [Wed, 19 Feb 2020 23:12:34 +0000 (15:12 -0800)]
Compute dep_for_build in one place.

4 years agoChange for_build_dep from a bool to enum FeaturesFor for clarity.
Eric Huss [Wed, 19 Feb 2020 23:05:43 +0000 (15:05 -0800)]
Change for_build_dep from a bool to enum FeaturesFor for clarity.

4 years agoChange have_dev_units from a bool to enum HasDevUnits for clarity.
Eric Huss [Wed, 19 Feb 2020 22:40:46 +0000 (14:40 -0800)]
Change have_dev_units from a bool to enum HasDevUnits for clarity.

4 years agoFix bug where required-features didn't work with -Zfeatures=build_dep correctly.
Eric Huss [Sun, 2 Feb 2020 22:27:16 +0000 (14:27 -0800)]
Fix bug where required-features didn't work with -Zfeatures=build_dep correctly.

4 years agoFix `cargo clean -p` crashing with -Zfeatures.
Eric Huss [Sun, 2 Feb 2020 21:21:31 +0000 (13:21 -0800)]
Fix `cargo clean -p` crashing with -Zfeatures.

4 years agoRewrite new feature resolver to simplify DepKind handling.
Eric Huss [Sun, 2 Feb 2020 19:54:29 +0000 (11:54 -0800)]
Rewrite new feature resolver to simplify DepKind handling.

Now that dev-dependencies are a global setting, only build-dependencies
matter. This is maybe a little simpler to understand?

4 years agoAdd comment explaining dep_kind in compute_deps_custom_build.
Eric Huss [Sat, 1 Feb 2020 23:20:24 +0000 (15:20 -0800)]
Add comment explaining dep_kind in compute_deps_custom_build.

4 years agoAdd `-Zfeatures=all` option.
Eric Huss [Sat, 1 Feb 2020 22:57:28 +0000 (14:57 -0800)]
Add `-Zfeatures=all` option.

4 years agoAdd a cyclical dev-dep test.
Eric Huss [Sat, 1 Feb 2020 22:33:51 +0000 (14:33 -0800)]
Add a cyclical dev-dep test.

4 years agoConsolidate -Zpackage-features member iteration logic.
Eric Huss [Sat, 1 Feb 2020 21:32:25 +0000 (13:32 -0800)]
Consolidate -Zpackage-features member iteration logic.

4 years agoAdd test for build script being run multiple times.
Eric Huss [Sat, 1 Feb 2020 19:38:05 +0000 (11:38 -0800)]
Add test for build script being run multiple times.

4 years agoAdd some comments to help clarify some features stuff from review.
Eric Huss [Fri, 31 Jan 2020 22:21:51 +0000 (14:21 -0800)]
Add some comments to help clarify some features stuff from review.

4 years agoDo not store `requested_features` in FeatureResolver.
Eric Huss [Fri, 31 Jan 2020 22:17:42 +0000 (14:17 -0800)]
Do not store `requested_features` in FeatureResolver.

This isn't really needed "globally", just at the beginning.

4 years agoEnsure dev-dep features are unified if any are used.
Eric Huss [Thu, 30 Jan 2020 19:12:23 +0000 (11:12 -0800)]
Ensure dev-dep features are unified if any are used.

There is a complex issue where `cargo test -Zfeatures=dev_dep` was
building things incorrectly if there was a binary executable. The issue
is that lib.rs needed to be built twice (once linked against normal
dependencies, once against dev dependencies), but the current Unit
structure can't distinguish between the two, and thus it was picking the
wrong one.

Instead of allowing `cargo test` to build binaries without
dev-dependency features, just link main.rs against the
dev-dependency-unified versions.

We may need to revisit this in the future, but for now it is not clear
what people want or how this should work. Fixing this would require
substantial changes to how unit dependencies are computed (to properly
handle deduplication), so for now we'll use a simpler solution. It would
also mean `cargo test` would take longer on some projects (because it
would need to build the library 3 times instead of twice).

4 years agoAdd new feature resolver.
Eric Huss [Tue, 10 Sep 2019 22:38:01 +0000 (15:38 -0700)]
Add new feature resolver.

4 years agoAdd a RequestedFeatures struct to hold cli features.
Eric Huss [Wed, 22 Jan 2020 01:34:54 +0000 (17:34 -0800)]
Add a RequestedFeatures struct to hold cli features.

The RequestedFeatures struct holds the features requested on the command
line.

4 years agoMove rustc target collection out of bcx.
Eric Huss [Wed, 22 Jan 2020 01:12:41 +0000 (17:12 -0800)]
Move rustc target collection out of bcx.

This allows querying it earlier, and independently of the rest of stuff in BuildContext.

4 years agoAuto merge of #7906 - ehuss:macos-10.15, r=alexcrichton
bors [Thu, 20 Feb 2020 03:25:54 +0000 (03:25 +0000)]
Auto merge of #7906 - ehuss:macos-10.15, r=alexcrichton

Switch azure to macOS 10.15.

Switches CI to the macOS 10.15 image.  Since 32-bit support is no longer available, this changes how cross-compile testing works.  I decided to use `x86_64-apple-ios` as a cross target, since it can easily build/link on macOS.  `cargo run` won't work without a simulator, so some of the tests are restructured to check if `cargo run` is allowed.  If you do have a simulator, it should Just Work.  CI doesn't seem to be configured with a simulator installed, and I didn't bother to look if that would be possible (the simulators tend to be several gigabytes in size).

An alternative approach would be to use wasm as a cross target, which is also fairly easy to support.  But wasm is a sufficiently different target that it can cause some issues in some tests, and is a bit harder to run as an executable.

This also adds some more help text on how to configure cross-compile tests.

Rustup is now installed on macOS by default, so no need to install it.  Unfortunately self-updates are not allowed, but hopefully that won't be an issue.

Closes #7821

4 years agoWork-around macOS 10.15 Gatekeeper issue.
Eric Huss [Thu, 20 Feb 2020 00:29:04 +0000 (16:29 -0800)]
Work-around macOS 10.15 Gatekeeper issue.

4 years agoSwitch azure to macOS 10.15.
Eric Huss [Sat, 8 Feb 2020 02:02:52 +0000 (18:02 -0800)]
Switch azure to macOS 10.15.

4 years agoAuto merge of #7892 - KaneGreen:rustc-about-text, r=ehuss
bors [Wed, 19 Feb 2020 20:33:53 +0000 (20:33 +0000)]
Auto merge of #7892 - KaneGreen:rustc-about-text, r=ehuss

Modified the help information of cargo-rustc

### Motivation
The original help information for `cargo build` is
> Compile a local package and all of its dependencies

And the original help information for `cargo rustc` is
> Compile a package and all of its dependencies

These messages are **too similar** to make it difficult to distinguish the differences between the two commands.

According to the [cargo book](https://doc.rust-lang.org/cargo/commands/cargo-rustc.html), `cargo rustc` is characterized by
> pass extra options to the compiler

I think this should be written into the help text of the command.

In addition, the `<args> ...` parameters of `cargo rustc` lack help text and need to be added.
### Modification
See the commit files.

### Problems
Maybe some words in my modification are not accurate enough. If you have better wording, welcome to point out. Thanks.

4 years agoAuto merge of #7904 - ehuss:rustfmt-1.4.12-fix, r=alexcrichton
bors [Wed, 19 Feb 2020 19:00:46 +0000 (19:00 +0000)]
Auto merge of #7904 - ehuss:rustfmt-1.4.12-fix, r=alexcrichton

Update for nightly rustfmt.

Most recently nightly seems to have slightly different behavior.

4 years agoUpdate for nightly rustfmt.
Eric Huss [Wed, 19 Feb 2020 18:40:39 +0000 (10:40 -0800)]
Update for nightly rustfmt.

4 years agoAuto merge of #7901 - ehuss:config-cli-path, r=alexcrichton
bors [Tue, 18 Feb 2020 20:08:05 +0000 (20:08 +0000)]
Auto merge of #7901 - ehuss:config-cli-path, r=alexcrichton

Support `--config path_to_config.toml` cli syntax.

Updates the `--config` flag so that if the argument appears to be a file, it will load the file.

cc #7722, #7723

4 years agoSupport `--config path_to_config.toml` cli syntax.
Eric Huss [Tue, 18 Feb 2020 17:30:27 +0000 (09:30 -0800)]
Support `--config path_to_config.toml` cli syntax.

4 years agoAuto merge of #7697 - ehuss:bin-test-env, r=alexcrichton
bors [Tue, 18 Feb 2020 15:24:43 +0000 (15:24 +0000)]
Auto merge of #7697 - ehuss:bin-test-env, r=alexcrichton

Set an environment variable for tests to find executables.

This adds the environment variable `CARGO_BIN_EXE_<name>` so that integration tests can find binaries to execute, instead of doing things like inspecting `env::current_exe()`.

The use of uppercase is primarily motivated by Windows whose Rust implementation behaves in a strange way.  It always ascii-upper-cases keys to implement case-insensitive matching (which loses the original case).  Seems less likely to result in confusion?

Closes #5758.

4 years agoAuto merge of #7896 - ehuss:internal-errors, r=alexcrichton
bors [Tue, 18 Feb 2020 14:42:57 +0000 (14:42 +0000)]
Auto merge of #7896 - ehuss:internal-errors, r=alexcrichton

Rework internal errors.

This changes the behavior of "internal" errors, which were previously hidden and only displayed with `--verbose`. The changes here:

- `internal` now means "a cargo bug", and is always displayed and requests that the user file a bug report.
- Added `VerboseError` to signify an error that should only be displayed with `--verbose`. This is only used in one place, to display the `rustc` compiler command if the compiler exited with a normal error code (i.e. not a crash).
- Audited the uses of internal errors, and promoted some to normal errors, as they seemed to contain useful information, but weren't necessarily bugs in cargo.
- Added some details to some errors.
- Sometimes the "run with --verbose" message wasn't being printed when I think it should. This happened when rustc failed while other rustc processes were running. Another case was with `cargo install` installing multiple packages, and one of them fails.

4 years agoRework internal errors.
Eric Huss [Tue, 18 Feb 2020 02:46:48 +0000 (18:46 -0800)]
Rework internal errors.

4 years agoModified the help information of cargo-rustc
KaneGreen [Mon, 17 Feb 2020 02:11:27 +0000 (10:11 +0800)]
Modified the help information of cargo-rustc

4 years agoAuto merge of #7891 - ehuss:stringlist-fixes, r=Eh2406
bors [Mon, 17 Feb 2020 00:08:14 +0000 (00:08 +0000)]
Auto merge of #7891 - ehuss:stringlist-fixes, r=Eh2406

Improvements to StringList config handling.

`StringList` was using an untagged enum to deserialize a string or list.  Unfortunately, serde does not handle untagged enums very well.  The error messages are not very good, and it doesn't interact with untyped deserializers (like our environment variables).  This switches it to a newtype struct, and then has hard-coded support for it in the deserializer.  This fixes some deserialization errors (like treating `true` as a boolean) and provides better error messages.

`StringList` is currently used for `build.rustflags`, `target.*.rustflags`, and `target.*.runner`.

Fixes #7780
Fixes #7781

4 years agoImprovements to StringList config handling.
Eric Huss [Sun, 16 Feb 2020 23:29:59 +0000 (15:29 -0800)]
Improvements to StringList config handling.

4 years agoAuto merge of #7890 - ehuss:fingerprint-log-rustflags, r=Eh2406
bors [Sun, 16 Feb 2020 20:10:00 +0000 (20:10 +0000)]
Auto merge of #7890 - ehuss:fingerprint-log-rustflags, r=Eh2406

Add new/old rustflags to fingerprint log.

Follow up to #7888. Due to a conversation with someone I had with Discord who was having trouble determining why something was rebuilding.