Commit graph

4322 commits

Author SHA1 Message Date
Nipunn Koorapati 0ab79d7aaf Deduplicate entries in cargo --list
Fixes #6088
2021-08-09 10:29:21 -07:00
Dustin J. Mitchell 1c5e68b4f3 Include aliases with other commands
The principal result is that they are now automatically included in the
`cargo --list` output.  Fixes #8486.
2021-08-07 13:52:12 +00:00
hi-rustin 27c103063c Use batch warnings and only warn about used dependency packages
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-08-07 14:10:14 +08:00
hi-rustin cc891a0bc5 Warning for no lib dependencies
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-08-07 11:51:59 +08:00
bors 33edacd1fd Auto merge of #9118 - bjorn3:profile_codegen_backend_option, r=joshtriplett
Add a profile option to select the codegen backend

This makes it possible to compile only specific crates with a certain codegen backend.

I have tested this by compiling Bevy with cg_llvm, but one of the examples using cg_clif.

By the way I noticed that many unstable profile options are not checked when using profile overrides.
2021-08-06 20:43:21 +00:00
Nipunn Koorapati dde290e6ff Refactor fake_file() away from cargo_command tests
There are already similar preexisting test helpers which
also work on windows. Port over the executable-creation
helper into the file() helper and things appear to pass.
2021-08-05 19:09:58 -07:00
bjorn3 1aa8fd5736 Fix test 2021-08-05 17:17:50 +02:00
bjorn3 88da2395bd Update test 2021-08-04 18:20:41 +02:00
Dirkjan Ochtman d783456598 Stabilize rust-version 2021-08-02 13:38:58 +02:00
Eric Huss 70a607eaa7 Remove nbsp characters. 2021-07-30 15:40:37 -07:00
Josh Triplett ab38ce0f44 Stabilize [env] sections
`[env]` sections seem to work as advertised.
2021-07-29 19:50:51 -07:00
bors cdf22d19c9 Auto merge of #9730 - hi-rustin:rustin-patch-doc-test, r=alexcrichton
doc test supports silent output

close https://github.com/rust-lang/cargo/issues/9728
2021-07-27 15:05:14 +00:00
hi-rustin 8ee5433c3a doc test supports silent output
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-07-27 15:49:59 +08:00
bors d21c22870e Auto merge of #9727 - ehuss:fix-version, r=alexcrichton
Fix version string.

The version string for `cargo version` was inadvertently changed in #9657 so that it does not include the leading `cargo` as in `cargo 1.53.0 (4369396ce 2021-04-27)`.
2021-07-26 20:23:21 +00:00
bors 9bc7a37533 Auto merge of #9559 - tcmal:master, r=ehuss
Allow publishing from workspace root.

Adds -p, --workspace, and --exclude to package and publish commands.

Uses ephemeral workspaces to avoid changing the existing functions too much.
There might be more `Finished dev [unoptimized + debuginfo] target` messages when packaging than there should be, I couldn't figure out what was generating them.
The tests aren't super extensive, as all the specs from arguments code should already be tested elsewhere.

Closes #7345
2021-07-26 19:58:01 +00:00
Eric Huss 30ff8424c9 Remove unnecessary format! 2021-07-26 12:56:53 -07:00
bors d403db6f17 Auto merge of #9723 - hi-rustin:rustin-patch-better-msg, r=ehuss
Better msg for wrong position

close https://github.com/rust-lang/cargo/issues/9717
2021-07-26 19:24:32 +00:00
Eric Huss fdc398e743 Fix version string. 2021-07-26 12:18:22 -07:00
bors 97007c99a5 Auto merge of #9557 - danielframpton:extra-link-args, r=ehuss
Stabilize the rustc-link-arg option

This change removes the unstable option (tracked by #9426) and unconditionally accepts additional linker arguments (as implemented in #7811 and #8441). Documentation is moved from unstable to what appeared to be the correct location.

I am not aware of any significant concerns with the option and it appears consistent with some other existing stable linker options.

Please let me know if this is not the appropriate process or if there is anything that I am missing from the PR.
2021-07-26 18:54:29 +00:00
tcmal 8f1f0e40fd feat(package+publish): package arguments
adds -p, --workspace, and --exclude to package command,
and -p to publish command, as well as tests for both.

closes #7345
2021-07-26 16:31:58 +01:00
hi-rustin 5ccb5a3f92 Refine name
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-07-25 00:35:09 +08:00
hi-rustin 10cfa40669 Better msg for wrong position
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-07-24 10:44:44 +08:00
bors 9535dc3dfd Auto merge of #9681 - hi-rustin:rustin-patch-reject, r=ehuss
Warning when using features in replace

close https://github.com/rust-lang/cargo/issues/3034
close https://github.com/rust-lang/cargo/issues/2582

r? `@ehuss`
2021-07-23 18:53:25 +00:00
hi-rustin 771356d821 Warning when using features in replace
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-07-23 15:00:50 +08:00
Daniel Frampton e73703944e Stabilize the extra link arg option 2021-07-22 09:57:00 -07:00
bors 121f4b3b5c Auto merge of #9653 - bjorn3:update_should_use_metadata, r=alexcrichton
Update should_use_metadata function

* Correct the reason for not renaming dylibs
* Add todo for -install-name/-soname usage
* Limit wasm32 executable metadata omission to emscripten. Wasm file don't contain any filename themself.
* Don't omit metadata for executables on macOS. backtrace-rs is now able to load debuginfo for renamed .dSYM files: ed3689c2f2/src/symbolize/gimli/macho.rs (L51-L65)
* Mention another reason to include the metadata hash for libstd.
2021-07-22 14:16:04 +00:00
Weihang Lo 8c75e2ffa0
Update tests to use registry names 2021-07-22 00:50:30 +08:00
bors 4e143fd131 Auto merge of #9685 - ehuss:named-profile-updates, r=alexcrichton
Named profile updates

A few updates for named profiles to push them closer to stabilization:

- Disable the `dir-name` profile setting. `dir-name` primarily exists for translating the built-in profiles or sharing artifacts between profiles. In order to simplify the UI, we would like to not expose it to the user for the initial stabilization. The code to support it is kept in case we want to add it in the future.
- Reserve some profile names. Just to give a little flexibility in the future in case we want to use these, or that they could cause confusion. Also updated the error text a little.
- Add support for custom profiles to legacy commands. Their old behavior is still retained for backwards compatibility. That is:
    * `cargo check`
        * `--profile=test`: This forces the test mode. For example, `cargo check --lib --profile=test` will check the library as a unit test (with `--test`).
    * `cargo fix`
        * `--profile=test`: Forces test mode, same as above.
    * `cargo rustc`
        * `--profile=test`: Forces test mode, same as above.
        * `--profile=bench`: Forces bench mode.
        * `--profile=check`: Forces check mode.
    - These commands also allow mixing the above options with `--release`, which is normally not allowed.
- Fix `cargo bench` to support the `--profile` option. I think it was just forgotten.
2021-07-20 21:55:45 +00:00
bors adde602238 Auto merge of #9601 - jonhoo:fix-9600, r=ehuss
Inform build scripts of rustc compiler context

Fixes #9600.
2021-07-20 21:27:35 +00:00
bors 54bc19ee56 Auto merge of #9675 - ehuss:diagnostic-dedupe, r=alexcrichton
Deduplicate compiler diagnostics.

This adds some logic to deduplicate diagnostics emitted across rustc invocations. There are some situations where different targets can emit the same message, and that has caused confusion particularly for new users. A prominent example is running `cargo test` which will build the library twice concurrently (once as a normal library, and once as a test).

As part of this, the "N warnings emitted" message sent by rustc is intercepted, and instead cargo generates its own summary. This is to prevent potentially confusing situations where that message is either deduplicated, or wrong. It also provides a little more context to explain exactly *what* issued the warnings.  Example:

```warning: `foo` (lib) generated 1 warning```

This only impacts human-readable output, it does not change JSON behavior.

Closes #9104
2021-07-16 15:22:58 +00:00
Eric Huss f00a85a871 Re-enable future-incompatible tests. 2021-07-16 05:45:29 -07:00
Jon Gjengset 1cbce47051 Remove RUSTC_VERSION envvar 2021-07-15 17:53:21 -07:00
Eric Huss 13fef863ab Add test demonstrating deduplication of errors. 2021-07-15 17:37:21 -07:00
bors ae51ab9203 Auto merge of #9694 - ehuss:edition-fix-latest, r=alexcrichton
`cargo fix --edition`: extend warning when on latest edition

This extends the warning issued when `cargo fix --edition` is run when the user is already on the latest edition.  Before #9184, there were instructions on what to do, but those probably should not have been completely removed.  It seems likely that some users may get the steps out of order, so this hopefully tries to explain them clearly.
2021-07-15 17:54:25 +00:00
Eric Huss be0cbb57c7 cargo fix --edition: extend warning when on latest edition 2021-07-15 07:26:26 -07:00
hi-rustin 6f214ac752 Make ignored key in config be an error
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-07-15 14:35:10 +08:00
hi-rustin 85ba14c68d Make the dependency specification ambiguous be an error
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-07-15 14:29:11 +08:00
bors 66a6737a0c Auto merge of #9663 - nebkor:master, r=alexcrichton
Add format option to `cargo tree` to print the lib_name

Adds a way to have `cargo tree` display the name of the library inside a package dependency, which can differ from the name of the package. Updates the `tree::format` test to test for its proper behavior.

Closes #9659
2021-07-14 20:54:28 +00:00
bors f8ba1cbfcb Auto merge of #9639 - djmitche:issue9535, r=Eh2406
Prefer patched versions of dependencies

When selecting among several versions of a paackage, prefer versions
from `[patch]` sections over other versions, similar to how locked
versions are preferred.

Patches come in the form of a Dependency and not a PackageId, so this
preference is expressed with `prefer_patch_deps`, distinct from
`try_to_use`.

Fixes #9535
2021-07-14 19:14:22 +00:00
bors 98d5d10268 Auto merge of #9686 - hi-rustin:rustin-patch-error, r=alexcrichton
When a dependency does not have a version, git or path, fails directly

Make this warning be an error.

ref: https://github.com/rust-lang/cargo/issues/9682#issuecomment-879108193
2021-07-14 16:09:57 +00:00
bors 3658906b07 Auto merge of #9665 - gilescope:giles-better-message, r=alexcrichton
Spot the crate typo easily

ego tweak to make it easy to spot typos:

Before:
```
error: no matching package named `sc-consensus-primitivies` found
location searched: /Users/bit/p/substrate1/client/primitives/consensus/common
perhaps you meant: sc-consensus-primitives
required by package `sc-network v0.9.0 (/Users/bit/p/substrate1/client/network)`
```
After:
```
error: no matching package named `sc-consensus-primitivies` found
perhaps you meant:                sc-consensus-primitives
location searched: /Users/bit/p/substrate1/client/primitives/consensus/common
required by package `sc-network v0.9.0 (/Users/bit/p/substrate1/client/network)`
```
2021-07-14 15:39:04 +00:00
gilescope e94199cb06
Only put it on a new line if there's candidates to compare against. 2021-07-14 08:27:52 +01:00
hi-rustin 5c66070803 When a dependency does not have a version, git or path, fails directly
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-07-14 14:09:45 +08:00
Eric Huss 73dba767d1 Support custom profiles in legacy commands.
This makes the following changes:

- Allows `cargo check`, `cargo fix`, and `cargo rustc` to support custom
  named profiles. This retains the legacy behavior of those commands.
- Fixes `cargo bench` so that it supports custom named profiles.
2021-07-13 15:22:09 -07:00
Eric Huss 51dc5db4e2 Reserve some names for named profiles.
Just to give a little flexibility in the future in case we want to use
these, or that they could cause confusion. Also updated the error text a
little.
2021-07-13 11:59:15 -07:00
Eric Huss 090eb4277f Disable the dir-name profile setting.
dir-name primarily exists for translating the built-in profiles. In
order to simplify the UI, we would like to not expose it to the user for
the initial stabilization. The code to support it is kept in case we
want to add it in the future.
2021-07-13 11:38:11 -07:00
Joe Ardent af355f0ea5 Use crate_name() on the library target, update tests. 2021-07-12 13:25:49 -07:00
Jon Gjengset d0c751bc8f Test when RUSTC_WORKSPACE_WRAPPER is not set 2021-07-12 09:34:39 -07:00
bors f2496ee6ee Auto merge of #9677 - ehuss:serialize-fix, r=alexcrichton
Serialize `cargo fix`

This changes `cargo fix` so that it only fixes one crate at a time. Previously, it would allow concurrent fixing across packages. This caused a problem if a workspace uses things like `#[path]` or `include!()` of a shared file between packages. A real-world example of this is serde, which has [this](9c39115f82/serde_derive_internals/lib.rs (L43-L45)) which reuses the some source files between the `serde` and `serde_derive` packages. Modifying those files concurrently causes corruption and the fix will fail.

Closes #6528
2021-07-12 16:16:36 +00:00
bors 01ddc251e5 Auto merge of #9657 - ehuss:clearer-nightly-requirements, r=alexcrichton
Update nightly failure notification.

This makes several changes to try to clarify errors with nightly requirements.

- Don't tell the user to edit `Cargo.toml` if it is not a local package. Things like registry packages are not under their control.
- Include the version number in the error message.
- Try to make better suggestions on what to do.
- Remove the redirects for stabilized features in unstable.md, and instead include a small stub that tells the user when it was stabilized and where to find more information. This should help with people using older releases which provide links to this page, to help them know which version they will need.

Closes #9610
2021-07-12 14:55:37 +00:00
bors 2517af47e1 Auto merge of #9654 - ehuss:windows-env-upper-check, r=alexcrichton
Update Windows env uppercase key check.

This is the followup for #9646. Rust now correctly spawns processes with preserved casing on nightly on Windows, so the exceptions here are no longer needed.
2021-07-12 14:26:23 +00:00
bors a51667c60d Auto merge of #9662 - ehuss:unignore-fix_edition_2021, r=alexcrichton
Unignore fix_edition_2021.

The issue has been fixed by https://github.com/rust-lang/rust/pull/86572.
2021-07-12 13:39:49 +00:00
hi-rustin add4ffc200 Reject when using features in replace
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-07-12 14:56:24 +08:00
Eric Huss c8e4f8e483 Serialize cargo fix 2021-07-10 18:47:52 -07:00
gilescope dc0e53b7c1
Reworking message to not care about an intial offset 2021-07-10 15:07:29 +01:00
Eric Huss 493e8b7dd1 Deduplicate compiler diagnostics. 2021-07-09 16:20:46 -07:00
Dustin J. Mitchell bd4a353e98 Prefer patched versions of dependencies
When selecting among several versions of a paackage, prefer versions
from `[patch]` sections over other versions, similar to how locked
versions are preferred.

Patches come in the form of a Dependency and not a PackageId, so this
preference is expressed with `prefer_patch_deps`, distinct from
`try_to_use`.
2021-07-09 18:23:21 +00:00
hi-rustin a846226f71 Remove unrelated cases
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-07-09 13:15:13 +08:00
Joe Ardent bc472c762b Change format character to 'lib'. 2021-07-08 15:59:07 -07:00
hi-rustin 8d2103f212 Warning when using features in patch
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-07-08 15:25:13 +08:00
Joe Ardent 6fb5a1de54 Add test for lib_name format character. 2021-07-07 00:05:08 -07:00
Eric Huss 93658ee1be Unignore fix_edition_2021. 2021-07-06 19:28:13 -07:00
Joshua Nelson 9c7cc545d7 Combine rustc and cargo's diagnostic summaries
This works by introspecting rustc's error output, using the JSON format
to determine whether it's a warning or error, then skipping it
altogether if it's a summary of the diagnostics printed.

Before:

```
src/main.rs:1:10: warning: trait objects without an explicit `dyn` are deprecated
src/main.rs:1:1: error[E0601]: `main` function not found in crate `wrong`
src/main.rs:1:9: error[E0038]: the trait `Clone` cannot be made into an object
error: aborting due to 2 previous errors; 1 warning emitted
error: could not compile `wrong`

```

After:

```
$ cargo check --message-format short
src/main.rs:1:10: warning: trait objects without an explicit `dyn` are deprecated
src/main.rs:1:1: error[E0601]: `main` function not found in crate `wrong`
src/main.rs:1:9: error[E0038]: the trait `Clone` cannot be made into an object
error: could not compile `wrong` due to 2 previous errors; 1 warning emitted
```
2021-07-06 19:46:27 -04:00
Jon Gjengset d6b4a06274 Also set RUSTC_WORKSPACE_WRAPPER for build.rs 2021-07-06 09:46:02 -07:00
Eric Huss 2c99f654c9 Update nightly failure notification. 2021-07-05 16:08:36 -07:00
Eric Huss 652c5d9d1f Update Windows env uppercase key check. 2021-07-05 10:10:51 -07:00
bjorn3 8c24820a3d Update test 2021-07-05 18:28:21 +02:00
Eric Huss 5559e028a8 Adjust the edition2021 resolver diff report. 2021-07-02 13:01:58 -07:00
bors 0a38a2138d Auto merge of #9647 - ehuss:fingerprint-linker, r=alexcrichton
Include the linker in the fingerprint.

This adds the linker from the `[target]` config table to the fingerprint. Previously, changing the value would not trigger a rebuild.
2021-07-02 15:10:51 +00:00
bors 6e31c1338d Auto merge of #9646 - ehuss:windows-case-disable, r=alexcrichton
Temporarily disable windows env test.

This temporarily disables the `target_in_environment_contains_lower_case` test on Windows until https://github.com/rust-lang/rust/pull/85270 gets into nightly.  That PR changes it so that env vars are case-preserved on Windows.  My intent is that after that is in nightly, we can remove the windows-specific code in `Config`, and this test should work the same on all platforms.

Closes #9630
2021-07-02 14:47:02 +00:00
bors b74705419e Auto merge of #9645 - ehuss:git-package-wt_deleted, r=alexcrichton
Handle git deleted files with dirty worktree.

When listing git files for things like `cargo package`, it was including unstaged deleted files. This is because the file is still in the index, so it was included in the list.  `cargo package --allow-dirty` would then fail with a confusing "file not found" error.

This fixes it by keeping a set of deleted files, and skipping those. This allows `cargo package --allow-dirty` to work.

Closes #9580
2021-07-02 14:22:23 +00:00
Eric Huss 28c3bef71a Include the linker in the fingerprint. 2021-07-01 20:33:48 -07:00
Eric Huss c10864a3c4 Temporarily disable windows env test. 2021-07-01 19:41:13 -07:00
Eric Huss 97a135049a Handle git deleted files with dirty worktree. 2021-07-01 18:10:35 -07:00
Eric Huss dd8fa9183d Adjust error message with offline and frozen. 2021-07-01 16:59:19 -07:00
bors 4952979031 Auto merge of #9531 - 5225225:cargo-doc-open-fix, r=ehuss
Fix `BorrowMutError` when calling `cargo doc --open`

~~I'm not sure why the existing test suite didn't catch this, it definitely calls `cargo doc --open`.~~

I had

```toml
[doc.extern-map]
std = "local"
```

in my `.cargo/config.toml`. Will write a test case that sets that and then tries to run `cargo doc --open`.

Closes #9530
2021-07-01 01:14:50 +00:00
Eric Huss aab51362d7 Temporarily ignore 2021 edition fix. 2021-06-30 09:36:22 -07:00
Jon Gjengset fa7c5b196f Use a more standard linker flag 2021-06-29 12:26:50 -07:00
Jon Gjengset fb0d41fcc5 Adopt CARGO_ENCODED_RUSTFLAGS 2021-06-29 12:08:50 -07:00
Eric Huss e7df0d136c Temporarily disable future_incompat tests. 2021-06-29 11:56:03 -07:00
5225225 950c415583 Fully match stderr, return if not nightly, shorten file 2021-06-28 19:01:16 +01:00
Jon Gjengset c16b9d4c55 Remove CARGO_VERSION* env vars
Cargo and Rustc are co-versioned at the moment anyway.
2021-06-25 11:01:23 -07:00
Jon Gjengset 49d33c4ec4 Expose cargo and rustc version envvars 2021-06-24 09:56:14 -07:00
Jon Gjengset 1e407453c2 Remove CARGO_ prefix for new build script envvars 2021-06-24 09:56:00 -07:00
bors 4c27c96645 Auto merge of #9612 - Bryysen:master, r=alexcrichton
Error when packaging with git dependencies without version

If `cargo package` is run on a package that specifies a git dependency
without a version, cargo will error. This should help with clarifying
that git dependencies will be stripped when packaging, and that the
dependency has to be fetched from a registry.
Closes #9442
2021-06-23 21:38:32 +00:00
Daniel Eades 706c8242e3 use 'writeln' instead of appending newline character 2021-06-23 12:20:18 +01:00
Bryysen 4e1910d9d3 Error when packaging with git dependencies without version
If `cargo package` is run on a package that specifies a git dependency
without a version, cargo will error. This should help with clarifying
that git dependencies will be stripped when packaging, and that the
dependency has to be fetched from a registry.
2021-06-23 02:01:29 +02:00
bors 9233aa06c8 Auto merge of #9607 - hi-rustin:rustin-patch-cargo-toml, r=ehuss
Detect incorrectly named cargo.toml

close https://github.com/rust-lang/cargo/issues/9541
2021-06-22 21:32:55 +00:00
bors a2589dda38 Auto merge of #9574 - ehuss:weak-namespaced, r=alexcrichton
Unify weak and namespaced features.

This unifies weak and namespaced features in order to simplify the syntax and semantics.  Previously there were four different ways to specify the feature of a dependency:

* `package-name/feature-name` — Enables feature `package-name` on self and enables `feature-name` on the dependency. (Today's behavior.)
* `package-name?/feature-name` — Only enables `feature-name` on the given package if it that package is enabled and will also activates a feature named `package-name` (which must be defined implicitly or explicitly).
* `dep:package-name/feature-name` — Enables dependency `package-name`, and enables `feature-name` on that dependency. This does NOT enable a feature named "package-name".
* `dep:package-name?/feature-name` — Only enables `feature-name` on the given package if it that package is enabled.  This does NOT enable a feature named "package-name".

This changes it so there are only two:

* `package-name/feature-name` — Today's behavior.
* `package-name?/feature-name` — Only enables `feature-name` on the given package if it that package is enabled.  This does NOT enable a feature named "package-name" (the same behavior as `dep:package-name?/feature-name` above).

This is a fairly subtle change, and in most cases probably won't be noticed.  However, it simplifies things which helps with writing documentation and explaining how it works.
2021-06-22 21:02:31 +00:00
bors 32238b4747 Auto merge of #9563 - ehuss:link-cdylib-warning, r=alexcrichton
Change `rustc-cdylib-link-arg` error to a warning.

In #9523, an error was added if `cargo:rustc-cdylib-link-arg` was issued in a build script without actually having a cdylib target. This uncovered that there was an unintentional change in #8441 to cause those link args to be applied to transitive dependencies.

This changes it so that the error is now a warning, with a note that this may become an error in the future. It also changes it so that the unstable `rustc-link-arg*` instructions only apply to the package that emitted them.
2021-06-22 19:27:25 +00:00
hi-rustin b3a1d0ceba Only testing on linux 2021-06-22 15:36:32 +08:00
hi-rustin cb1a3f05f0 Detect incorrectly named cargo.toml for build 2021-06-22 15:31:28 +08:00
hi-rustin a2f903275a Detect incorrectly named cargo.toml for install --path 2021-06-22 15:31:28 +08:00
hi-rustin d9daaf7a84 Detect incorrectly named cargo.toml for install --git 2021-06-22 15:31:21 +08:00
Eric Huss afe7314ede Don't trigger an update when looking for suggestions. 2021-06-21 09:55:29 -07:00
Eric Huss a93bfcbdff Print reports using shell to handle old Windows colors properly. 2021-06-21 09:50:42 -07:00
Eric Huss 71cb59b6ef Future-incompat report: Add suggestions of newer versions. 2021-06-21 09:49:43 -07:00
Eric Huss 1f7141f892 Add future-incompat as an alias for future-incompatibilities. 2021-06-21 09:49:43 -07:00
Eric Huss c2b02b3926 Updates to future-incompatible reporting. 2021-06-21 09:49:41 -07:00
bors 9548b78ac9 Auto merge of #9579 - wickerwaka:env-config-override, r=ehuss
Don't allow config env to modify vars set by cargo

This changes how the `[env]` variables are applied. They will no longer replace any variables that are being set by cargo itself, whether or not the `force` flag is set. The `force` flag still determines whether existing variables from the environment can be overridden or not.

Addresses unresolved issue in #9539
2021-06-21 15:09:41 +00:00
Eric Huss c0dca04f49 Disambiguate is_symlink. 2021-06-19 11:27:14 -07:00
5225225 9e4c0e1e44 Don't use CargoDocConfig struct 2021-06-19 17:45:44 +01:00
Jon Gjengset 8012d328ee Avoid coercing path to string for windows 2021-06-18 12:40:29 -07:00
Jon Gjengset 719eb593c8 Add tests for rustc context build script env vars 2021-06-18 12:15:03 -07:00
bors c111cad106 Auto merge of #9596 - ehuss:fix-dep-info-local, r=alexcrichton
Fix dep-info files including non-local build script paths.

I derped in #8177 and accidentally used the wrong unit when iterating over the dependencies when writing the `.d` file.  The consequence here is that all the `rerun-if-changed` paths from a unit's dependencies are included in the `.d` file. This fixes it so that it does not include non-local dependencies.

Fixes #9445
2021-06-18 03:38:12 +00:00
Eric Huss 2db502f766 Fix dep-info files including non-local build script paths. 2021-06-17 18:28:42 -07:00
Eric Huss bd4010c43d Relax doc collision error. 2021-06-17 16:28:17 -07:00
Henri Francois 0663b713b7 Handling job=0 argument in cargo config files. 2021-06-17 09:18:59 -07:00
bors 40df0f17b5 Auto merge of #9589 - ehuss:testsuite-diff, r=alexcrichton
Enhancements to testsuite error output.

This includes several changes to the testsuite error reporting in theory to help make it easier to see differences when the test output changes. The key change is to add a Myers diff with a little colored output to highlight the differences. Here is an example:

<img width="666" alt="image" src="https://user-images.githubusercontent.com/43198/122311381-e8d43580-cec6-11eb-81b4-e2675f10d6ba.png">

The rest of the changes here are various refactorings to try to clean up the diffing code.  It ended up being far more changes than I was intending, but I did try to split things into commits to separate them.
2021-06-17 14:50:47 +00:00
Eric Huss 16b5402fd7 testsuite: Switch to colored diffs with Myers diff. 2021-06-16 15:43:29 -07:00
Eric Huss 205148e645 Only normalize paths on windows.
I don't trust that all these transformations won't have unintended
consequences on other platforms. It is nice to verify there aren't any
backslash shenanigans on other platforms.
2021-06-16 10:35:26 -07:00
Eric Huss aea5ca3ca0 Remove the double-backslash escape for matching.
Using `with_json` is safer since it knows what JSON escaping is.
2021-06-16 09:44:29 -07:00
Eric Huss b73e3d4fa5 Don't export lines_match.
Use better high-level interfaces to achieve the same thing.
2021-06-16 09:44:29 -07:00
Eric Huss b9f15ab1f0 Remove got_symlink_permission, we already have one of those. 2021-06-16 09:44:29 -07:00
Eric Huss 24b8936c20 Remove normalized_lines_match, it is not needed. 2021-06-16 09:44:29 -07:00
Eric Huss 6dff99781d Remove with_either_contains.
It isn't needed anymore, and I would prefer to not keep around unused code.
It can always be added back if ever needed again.
2021-06-16 09:44:29 -07:00
Eric Huss e132bb53ab Move comparison and diffing code to a new module.
This includes various minor refactorings to try to clean things up
and provide better error messages.
2021-06-16 09:44:29 -07:00
bors 7cdf5344ff Auto merge of #9588 - ehuss:edition2021-force-warns, r=alexcrichton
Enable support for fix --edition for 2021.

This adds support for using `cargo fix --edition` to migrate to 2021.

This also uses the new, currently unstable, `--force-warns` flag. This was added because there were a significant number of crates that were "allow"ing lints that are required for migrating the edition. This wasn't a problem for 2018, because its lints were new, and all "allow" to start.  For 2021, several older "warn" lints are becoming hard errors.  "allow"ing them would cause the migration to fail.
2021-06-16 14:51:06 +00:00
bors ee8497b09f Auto merge of #9582 - hi-rustin:rustin-patch-errors, r=ehuss
Add more details for installing git repository errors

close https://github.com/rust-lang/cargo/issues/9422
close https://github.com/rust-lang/cargo/issues/9011

r? `@ehuss`
2021-06-16 13:03:19 +00:00
Eric Huss 5825206acf Enable support for fix --edition for 2021. 2021-06-15 13:13:35 -07:00
bors 3b17193594 Auto merge of #9568 - hi-rustin:rustin-patch-error, r=alexcrichton
More information for links conflicting

close https://github.com/rust-lang/cargo/issues/9294
2021-06-14 14:14:55 +00:00
hi-rustin 5e86dd455d Add more details when installing git repository errors 2021-06-14 14:41:49 +08:00
Martin Donlon ac05a8526f Don't allow config env to modify vars set by cargo 2021-06-12 08:48:23 -07:00
Eric Huss 2492bf53ab Fix package_default_run.
The output was checking the `targets`, whose order depends on the
filesystem order. Instead of checking all the output, just
check the one field this test is for.
2021-06-11 16:09:32 -07:00
Eric Huss 393077f968 Add run_json to Execs.
This is a helper to run the process and return a JSON object.
2021-06-11 16:07:20 -07:00
Eric Huss 9034e488ff Unify weak and namespaced features. 2021-06-11 07:27:33 -07:00
Sunjay Varma f68cdb9947 Change how the fix_deny_warnings_but_not_others test works to avoid breakage from new compiler suggestions 2021-06-10 16:49:29 -07:00
bors da2c7705e4 Auto merge of #9561 - In-line:add-warning-for-ignored-arguments, r=ehuss
Implement warning for ignored trailing arguments
2021-06-10 15:47:52 +00:00
bors 40b674cd11 Auto merge of #9566 - ehuss:relative-rustc-path, r=alexcrichton
Fix rustc/rustdoc config values to be config-relative.

The `rustc`, `rustdoc`, `rustc_wrapper`, and `rustc_workspace_wrapper` config values (in the `[build]` table) were being interpreted literally. This caused a problem if you used a relative path like `foo/rustc`.  This would be interpreted as a relative path from whatever cwd cargo launches rustc from, which changes for different scenarios, making it essentially unusuable (since crates.io dependencies wouldn't be buildable).

Additionally, due to https://github.com/rust-lang/rust/issues/37868, it is a bad idea to use relative paths.

This changes it so that those paths are config-relative.  Bare names (like "my-rustc-program") still use PATH as before.

This also includes a commit to centralize the rustc-wrapper program used by several tests so that it isn't built multiple times (and to allow several tests to work on windows).

Fixes #8202
2021-06-10 14:15:18 +00:00
hi-rustin 724cf0f0eb More information for links conflicting 2021-06-10 15:12:19 +08:00
Eric Huss 9362fe5ff3 Update rustfix. 2021-06-09 18:13:56 -07:00
Eric Huss 47a02919cc Fix rustc/rustdoc config values to be config-relative paths. 2021-06-09 17:46:18 -07:00
Eric Huss 7b229bbe39 Move the rustc-echo-wrapper to be shared across tests.
This helps avoid rebuilding the same project several times.
2021-06-09 17:13:33 -07:00
Eric Huss 2bcece90a8 Change rustc-cdylib-link-arg error to a warning. 2021-06-09 14:24:12 -07:00
Bryysen da1c2f3b9c Warn if an "all" target is specified, but we don't match anything
If a combination of --bins, --benches, --examples, --tests flags have
been specified, but we didn't match on anything after resolving the unit-list,
we emit a warning to make it clear that cargo didn't do anything and that the
code is unchecked.

Closes #9536
2021-06-09 19:29:24 +02:00
bors 66686fd995 Auto merge of #9550 - hi-rustin:rustin-patch-feat, r=ehuss
add default_run to SerializedPackage

close https://github.com/rust-lang/cargo/issues/9497
2021-06-09 16:50:47 +00:00
bors 2544bd3418 Auto merge of #9522 - Aelnor:respect_user_choice_of_binlib, r=ehuss
respect user choice of lib/bin over heuristics

This one fixes #9333
2021-06-09 16:26:15 +00:00
Alik Aslanyan e5d10f973d
Implement warning for ignored trailing arguments
in case built-in `cargo` command was invoked with `--`
2021-06-09 18:50:51 +04:00
bors aa8b09297b Auto merge of #9520 - weihanglo:tree-prune, r=ehuss
Add `--prune` option for cargo-tree

Part of #8105

Prune the given package from the display of the dependency tree. Also providing a nice suggestion if the package is not within the resolved dependency graph.
2021-06-09 00:28:53 +00:00
hi-rustin 1abc4f2e8a Add test and update docs 2021-06-08 11:28:58 +08:00
hi-rustin c971400330 Make test happy 2021-06-07 14:59:59 +08:00
hi-rustin f9a5625733 add default_run to SerializedPackage
Delete "default_run": null,
2021-06-07 14:59:57 +08:00
5225225 1919ce7ce5 Add test to try to catch doc --open issue with extern-map 2021-06-06 13:28:45 +01:00
Rémi Verschelde 0a40a0aea4
Replace deprecated [replace] references with [patch]
Cf. #7092.
2021-06-02 12:30:56 +02:00
bors 0cecbd6732 Auto merge of #9322 - jameshilliard:split-host, r=joshtriplett
Configure hosts separately from targets when --target is specified.

This prevents target configs from accidentally being picked up when cross compiling from hosts that have the same architecture as their targets.

closes #3349
2021-06-01 20:09:13 +00:00
bors 6597523527 Auto merge of #9523 - ehuss:link-args-validate, r=alexcrichton
Add some validation to rustc-link-arg

This adds some validation, so that if a `cargo:rustc-link-arg-*` build script instruction specifies a target that doesn't exist, it will generate an error.  This also changes a parse warning to an error if the `=` is missing from BIN=ARG.

I intentionally did not bother to add the validation to config overrides, as it is a bit trickier to do, and that feature is very rarely used (AFAIK), and I'm uncertain if rustc-link-arg is really useful in that context.

cc #9426
2021-06-01 17:26:35 +00:00
Alexey Chernyshov 3bc2341b56 change simple quotes with backticks for file names 2021-06-01 20:13:45 +03:00
Alexey Chernyshov e1a6bf454b Update tests/testsuite/init.rs
Co-authored-by: Weihang Lo <weihanglo@users.noreply.github.com>
2021-06-01 19:54:54 +03:00
bors 5fb59b0e4a Auto merge of #9420 - In-line:unknown-features-suggestions-in-workspace, r=ehuss
Implement suggestions for unknown features in workspace
2021-06-01 15:41:27 +00:00
Eric Huss 81defa6d1e Consolidate doc collision detection. 2021-05-30 19:39:48 -07:00
Alexey Chernyshov 3f8fc0e66a respect user choice of lib/bin over heuristics 2021-05-30 15:24:29 +03:00
Eric Huss 836e537bc0 Make cargo:rustc-link-arg-bin without the = an error. 2021-05-29 16:12:11 -07:00
Eric Huss f676b49e52 Add some errors if rustc-link-arg-* specifies a non-existent target. 2021-05-29 16:00:35 -07:00
Weihang Lo 64f5d10113
test(carog-tree): new --prune option 2021-05-29 11:45:10 +08:00
Weihang Lo da2327f129
Merge branch 'master' into tree-depth 2021-05-28 23:27:42 +08:00
bors 238a9fa71f Auto merge of #9488 - weihanglo:issue-9165, r=ehuss
`cargo tree -e no-proc-macro` to hide procedural macro dependencies

Probably resolves #9165

`cargo tree -e no-proc-macro` now hides procedural macro dependencies.

Note that when passed with `--invert <spec>`, the spec's reverse proc-macro dependencies are also hidden. Is this desired result?

Also, since I want `-p <spec>` and `-i <spec>` works with any valid package-id in the project, the filter logic is written in print stage instead of graph build stage
2021-05-28 14:55:26 +00:00
bors 2f3df16921 Auto merge of #9508 - dtolnay-contrib:semver, r=ehuss
Update to semver 1.0.0

I am working on a 1.0.0 of the `semver` crate some time this week. It would be good to confirm Cargo will be able to use it, beforehand!

It's a from-scratch rewrite, but https://github.com/dtolnay/semver/issues/237 has code to compare against 0.10.0 (currently used by Cargo) how every possible version requirement currently published to crates.io matches against every possible crate version. The differences are all broken syntax like `^0-.11.0` previously parsing with ".11.0" as a pre-release string (which is invalid, because pre-release are not allowed to contain empty dot-separated identifiers) and `~2.0-2.2` previously parsing with "2.2" as a pre-release string, when the user almost certainly meant `>=2.0, <=2.2`. I'm not sure how much of those you want to add code into Cargo to preserve behavior, but I would be happy to do it.
2021-05-27 22:34:28 +00:00
bors cc75485f72 Auto merge of #9517 - alexcrichton:update-rrar, r=ehuss
Update tar dependency to 0.4.35

Pulls in a fix which should avoid 0 mtime files from showing up.

Closes #9512
2021-05-27 22:08:08 +00:00
Alex Crichton a02b6e5bfc Update tar dependency to 0.4.34
Pulls in a fix which should avoid 0 mtime files from showing up.

Closes #9512
2021-05-27 14:16:59 -07:00
David Tolnay 396bdd3a89
Remove parsing of broken version syntax from 5 years ago 2021-05-26 14:37:39 -07:00
David Tolnay 3b62e466ec
Update to semver 1.0.0-rc 2021-05-25 17:42:05 -07:00
bors e931e4796b Auto merge of #9486 - Dirbaio:link-arg-bin, r=ehuss
Add `cargo:rustc-link-arg-bin` flag.

This PR implements a `cargo:rustc-link-arg-bin` command to specify per-binary link args from build scripts. This follows the suggestion from the tracking issue #9426.

Syntax is `cargo:rustc-link-arg-bin=BIN_NAME=ARG`

This was previously possible to do using the `#[link_args=".."]` attribute, but it was removed in rust-lang/rust#83820 in favor of the Cargo extra-link-args feature, which can currently not specify different link args for different bins in the same crate. This PR adds back the ability to do that.
2021-05-24 16:17:27 +00:00
bors f898eff9b9 Auto merge of #9473 - lf-:meow, r=ehuss
Add a cargo-doc.browser config option

The idea of this option is to allow cargo to use a separate browser from
the rest of the system. My motivation in doing this is that I want to
write a script that adds a symbolic link in some web root on my system
such that I can access my docs via the http protocol to avoid the
limitations of the file protocol that are accessibility problems for me.
For instance, zoom is not retained across multiple pages and Stylus
filters don't work well.
2021-05-24 15:54:16 +00:00
Eric Huss 61b762b9ff Remove unneeded masquerade_as_nightly_cargo.
This was accidentally missed when it was stabilized.
2021-05-24 08:18:14 -07:00
Dario Nieuwenhuis 160756368f Add test for cargo:rustc-link-arg-bin=foo=--bar 2021-05-20 21:41:17 +02:00
Alik Aslanyan 766c3bbcb8 Merge branch 'master' of github.com:rust-lang/cargo into unknown-feature-resolver-1 2021-05-20 08:34:48 +04:00
Weihang Lo 62d811d9f7
test(cargo-tree): --depth option 2021-05-19 09:29:47 +08:00
Jade 50486be0c0 testsuite/doc: Check the arguments used to invoke the browser
Previously we apparently weren't doing this as we weren't checking
stdout.
2021-05-15 18:59:24 -07:00
Jade ed46a9a4de test path and args 2021-05-15 14:23:44 -07:00
Weihang Lo a5139b96b9
test: cargo tree incorrect --edges arg 2021-05-16 02:00:56 +08:00
Weihang Lo c8af63795e
test: assert no-proc-macro for existing tests 2021-05-16 02:00:22 +08:00
Alik Aslanyan 503a8670d9
Another way to fix 2021-05-13 11:30:46 +04:00
Jade e840c8e81c Add a cargo-doc.browser config option
The idea of this option is to allow cargo to use a separate browser from
the rest of the system. My motivation in doing this is that I want to
write a script that adds a symbolic link in some web root on my system
such that I can access my docs via the http protocol to avoid the
limitations of the file protocol that are accessibility problems for me.
For instance, zoom is not retained across multiple pages and Stylus
filters don't work well.
2021-05-10 21:04:41 -07:00
Eric Huss a200640dbd Improve performance of git status check in cargo package. 2021-05-10 18:15:05 -07:00
bors 5b37ab3c7e Auto merge of #9472 - r00ster91:bettererrors, r=alexcrichton
Improve two error messages

The first error message saying "an integer" is confusing because if you give it `4` it's an integer but it will still complain that it must be an integer. So it's more specific now and tells you that it actually needs to be `1`, `2` or `3`.
In the second error there was a space missing. It says `is not a valid setting,must be`.
2021-05-10 15:35:17 +00:00
r00ster91 b381fdb71e Improve two error messages 2021-05-10 17:28:19 +02:00
Eric Huss 9387a308f4 Fix cargo install with a semver metadata version. 2021-05-08 17:21:52 -07:00
Vojtech Kral 64bfe7f1de Add CARGO_TARGET_TMPDIR env var for integration tests & benches
The variable is set to $target_dir/$config/tmp
This is a directory where tests & benches can place testcasei-related data
for use by the tests.
cargo makes sure the directory exists when building tests/benches.
2021-05-06 23:47:28 +02:00
Alik Aslanyan 21152659a1 Move check to the end of function, rework error message 2021-05-06 09:31:22 +04:00
bors 1228f49d74 Auto merge of #9438 - ehuss:report-subcommand, r=alexcrichton
Add `report` subcommand.

This renames the `cargo describe-future-incompatibilities` subcommand to `cargo report future-incompatibilities`. The intent here is to have a general `report` subcommand that can be used for other reports in the future. This helps avoid the proliferation of top-level subcommands, and to help keep the CLI a little more organized.
2021-05-03 14:41:36 +00:00
Alik Aslanyan 8c4b0a8559
Remove trailing space 2021-05-03 09:08:53 +00:00
Alik Aslanyan f46145312c Fix bug when with resolver = "1" non-virtual package was allowing unknown features 2021-05-03 13:06:34 +04:00
James Hilliard 6dcfe51bdb Test that setting -Zhost-config without -Ztarget-applies-to-host fails. 2021-05-01 12:28:32 -06:00
bors db741ac733 Auto merge of #9186 - weihanglo:issue-9054, r=alexcrichton
Respect Cargo.toml `[package.exclude]` even not in a git repo.

May resolves #9054

This bug (or feature?) has been lingering for a while. #7680 fixed the `cargo package` part but `cargo vendor` is still affected by the heuristic rule of ignoring dotfiles. ~~I propose to drop the rule and include dotfiles by default even if the package is not under git-controlled~~. See below.

## Updated: Changes Summary

`cargo vendor` vendors dependencies without git-controlled but `cargo package` often runs under a VCS like git. [These lines](https://github.com/rust-lang/cargo/blob/1ca930b/src/cargo/sources/path.rs#L161-L168) are where they diverges: `fn list_files_walk_except_dot_files_and_dirs` builds [its own ignore instance], which cannot merge with other filter rules from `[package.exclude]`. This causes some patterns to not work as expected, such as re-including file after ignoring dotfiles `[.*, !negated_file]`.

To make re-include (negate) rule works, this patch adds the excluding dotfiles rule directly into the `package.exclude` ignore instance if **_no include option nor git repo exists_**. Other old behaviors should not change in this patch.

[its own ignore instance]: https://github.com/rust-lang/cargo/blob/1ca930b6/src/cargo/sources/path.rs#L364-L366
2021-05-01 15:35:48 +00:00
Eric Huss ff49b829e6 Add report subcommand. 2021-04-30 13:01:21 -07:00
Alik Aslanyan f2b5271a09
Cargo fmt 2021-04-30 10:55:36 +04:00
Alik Aslanyan e80b5c2f8b
Add failing test 2021-04-30 10:47:44 +04:00
Alik Aslanyan 1439dab8c0
Add failing tests & fix them 2021-04-30 09:56:24 +04:00
bors 96be6747cd Auto merge of #9434 - ehuss:collision-doc-j1, r=Eh2406
Fix collision doc tests randomly failing.

This fixes some tests that were randomly failing on CI. The cause is that #9419 added a remove_dir_all on the `doc` directory. However, if two jobs are trying to write to that directory at the same time, this can cause errors.  The failure rate is low (a little over 1%), and I was unable to reproduce locally (only on GitHub's CI and only on the Windows job).

The solution is to run the jobs with -j1 so they run serially.

 I only saw errors for `collision_doc_sources`, but to be on the safe side I added j1 to similar tests.
2021-04-29 18:21:49 +00:00
Eric Huss 5003d53c79 Fix collision doc tests randomly failing. 2021-04-29 10:42:42 -07:00
bors 5b76b84f7a Auto merge of #9421 - lf-:meowwwwww, r=alexcrichton
Fix dep-info files emitting paths relative to deps' roots

Sample `shoo.d` file prior to this change is below, note the `build.rs`
at the end, which was not from my package.

From booping the debugger, I found this was coming from
`compiler_builtins`.  This is not really their bug though: if a build.rs
asks for rerun-if-changed on some crate relative path, this will happen
in general. So I've fixed it in Cargo and added a test to prevent it
regressing.

```
target/riscv64imac-mu-shoo-elf/release/shoo: /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/core_arch_docs.md /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/macros.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/mod.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd_llvm.rs crates/build_bits/src/lib.rs shoo/src/main.rs shoo/src/task.rs shoo/src/vectors.s build.rs
```

This change fixes it so it's like:

```
target/riscv64imac-mu-shoo-elf/release/shoo: /home/jade/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.39/build.rs /home/jade/.cargo/registry/src/github.com-1ecc6299db9ec823/log-0.4.14/build.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/core_arch_docs.md /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/macros.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/mod.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd_llvm.rs crates/build_bits/src/lib.rs shoo/src/main.rs shoo/src/task.rs shoo/src/vectors.s
```
2021-04-29 14:54:23 +00:00
Yuki Okushi e5ab39145f Only deny the unused_mut lint 2021-04-28 17:59:57 +09:00
Jade b998364e6b Fix test on Windows: reprise 2021-04-27 22:30:35 -07:00
Jade 5bba21afe4 Fix the test on Windows 2021-04-27 21:21:56 -07:00
bors 4369396ce7 Auto merge of #9419 - ehuss:doc-meta-rebuild, r=alexcrichton
Fix rebuild issues with rustdoc.

This fixes two issues related to rebuilds with rustdoc:

* Switching features when running `cargo doc` would result in Cargo not rebuilding the documentation. This is because it was keeping the fingerprints in separate directories based on the features used. However, the rustdoc output isn't keyed off the metadata hash, so although the old fingerprint seemed "up to date", in reality the documentation was rewritten and needs to be rebuilt. The solution is to use a simplified hash for the fingerprint directory name.
* Removing items does not remove the files from the doc directory. This changes it to clear the package's doc directory before running rustdoc, to ensure any stale files are removed.

I'm a little concerned about potential performance impact of running `remove_dir_all`, but I think it shouldn't be too bad?

Fixes #7370
2021-04-27 14:35:53 +00:00
Jade fc5840d175 Fix dep-info files emitting paths relative to deps' roots
Sample `shoo.d` file prior to this change is below, note the `build.rs`
at the end, which was not from my package.

From booping the debugger, I found this was coming from
`compiler_builtins`.  This is not really their bug though: if a build.rs
asks for rerun-if-changed on some crate relative path, this will happen
in general. So I've fixed it in Cargo and added a test to prevent it
regressing.

```
target/riscv64imac-mu-shoo-elf/release/shoo: /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/core_arch_docs.md /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/macros.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/mod.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd_llvm.rs crates/build_bits/src/lib.rs shoo/src/main.rs shoo/src/task.rs shoo/src/vectors.s build.rs
```

This change fixes it so it's like:

```
target/riscv64imac-mu-shoo-elf/release/shoo: /home/jade/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.39/build.rs /home/jade/.cargo/registry/src/github.com-1ecc6299db9ec823/log-0.4.14/build.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/core_arch_docs.md /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/macros.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/mod.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd_llvm.rs crates/build_bits/src/lib.rs shoo/src/main.rs shoo/src/task.rs shoo/src/vectors.s
```
2021-04-27 05:08:33 -07:00
Alik Aslanyan 3786b27367
Update test 2021-04-27 09:36:07 +00:00
Alik Aslanyan 0847630d07
Implement suggestions for unknown features in workspace 2021-04-27 13:09:44 +04:00
Eric Huss 44c549e650 Clear rustdoc output just before running rustdoc. 2021-04-26 21:04:01 -07:00
Eric Huss 77855f3636 Use consolidated fingerprint directory for rustdoc. 2021-04-26 21:02:29 -07:00