Commit graph

11138 commits

Author SHA1 Message Date
dependabot[bot] fc3e5697cd
Update env_logger requirement from 0.8.1 to 0.9.0
Updates the requirements on [env_logger](https://github.com/env-logger-rs/env_logger) to permit the latest version.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.8.1...v0.9.0)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-15 01:07:00 +00: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
bors 38c8ce6cab Auto merge of #9616 - danieleades:refactor/unnecessary-collect, r=alexcrichton
remove unnecessary 'collect'

would appreciate a review of this one, as i'm not sure the terminology i've used here is ideal...

but you get the drift. no need to allocate a vector here.
2021-07-13 14:11:27 +00:00
Daniel Eades 592b01c7bc fix inverted logic 2021-07-12 21:48:33 +01:00
Joe Ardent af355f0ea5 Use crate_name() on the library target, update tests. 2021-07-12 13:25:49 -07:00
Daniel Eades a255d96aed remove unnecessary 'collect' 2021-07-12 21:24:56 +01:00
bors 197e657b5b Auto merge of #9679 - ehuss:testsuite-custom-toolchain, r=alexcrichton
Make it easier to run testsuite with a custom toolchain.

The optimization added in #9206 to circumvent the rustup wrapper for rustc had a bad interaction when using a custom toolchain (like `cargo +stage1 test`).  It was using the `rustc` from where `cargo` is located, but custom toolchains often don't have cargo. This would instead use the nightly rustc (due to rustup's [fallback](eaee3e723c/src/config.rs (L942-L975))).  This changes it to query rustup directly to ask it where the overridden rustc is located.
2021-07-12 16:41:52 +00: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 f4e1110e81 Auto merge of #9658 - ehuss:cargo.toml-preamble-link, r=alexcrichton
Don't recommend filing issues on rust-lang/cargo for Cargo.toml errors.

I don't think this suggestion has ever led to something useful, and is just confusing.

cc #9610
2021-07-12 15:24:26 +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
Joe Ardent 58ed2e3746 Update the docs for tree to include new format option. 2021-07-11 16:47:34 -07:00
Eric Huss b67454c660 Make it easier to run testsuite with a custom toolchain. 2021-07-11 14:02:47 -07: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
bors 18f25982ae Auto merge of #9666 - hi-rustin:rustin-patch-warn, r=ehuss
Warning when using features in patch

part of https://github.com/rust-lang/cargo/issues/3034
2021-07-09 19:29:28 +00: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 69c328cd0c Change name of enum variant to better match the formatting "character". 2021-07-08 16:01:51 -07:00
Joe Ardent bc472c762b Change format character to 'lib'. 2021-07-08 15:59:07 -07:00
Eric Huss 7c66ef518b Don't recommend filing issues on rust-lang/cargo for Cargo.toml errors. 2021-07-08 13:04:57 -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
gilescope 671ba3fdfe
Spot the typo easily 2021-07-07 19:20:22 +01:00
Joe Ardent 7595a25419 Only look for lib name, do nothing if no lib target. 2021-07-07 10:32:06 -07:00
bors cc80b40f1c Auto merge of #9655 - jyn514:verbose, r=ehuss
Unify cargo and rustc's error reporting

Fixes https://github.com/rust-lang/rust/issues/86854.

 ## Don't print "run the command again with --verbose"

Here is a typical error seen by users of Cargo:

```
error[E0601]: `main` function not found in crate `wrong`
  |
  = note: consider adding a `main` function to `src/main.rs`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0601`.
error: could not compile `wrong`

To learn more, run the command again with --verbose.
```

The `--verbose` output is not particularly helpful in this case. The
error is unrelated to what cargo is doing, and passing `--verbose` will
not give useful information about how to proceed. Additionally, it's
unclear that `--verbose` is referring to the cargo command and not
rustc; this is especially true when cargo is wrapped by another build
system (such as Meson, x.py, or Make).

This omits the "run the command again with --verbose" output. --verbose
is still shown in `cargo build --help`, but it's not singled out above
all the other options.

 ##  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:

```
$ 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: 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-07 16:51:14 +00:00
Joe Ardent e019724025 Look for regular lib first. 2021-07-07 09:22:03 -07:00
Joe Ardent 47c3004533 Don't collect into a Vec, just find the target and get its name or default. 2021-07-07 09:19:31 -07:00
Joe Ardent 6fb5a1de54 Add test for lib_name format character. 2021-07-07 00:05:08 -07:00
Joe Ardent df62c36b21 reformat with rustfmt 2021-07-06 23:15:53 -07:00
Joe Ardent 216b816db3 Add format control character, 'n', for lib_name of lib dependency.
Corresponds to what you'd put in a `use` statement. See https://github.com/rust-lang/cargo/issues/9659
2021-07-06 23:08:21 -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
Eric Huss 2c99f654c9 Update nightly failure notification. 2021-07-05 16:08:36 -07:00
Joshua Nelson 768b5658c2 Don't print "run the command again with --verbose"
Here is a typical error seen by users of Cargo:

```
error[E0601]: `main` function not found in crate `wrong`
  |
  = note: consider adding a `main` function to `src/main.rs`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0601`.
error: could not compile `wrong`

To learn more, run the command again with --verbose.
```

The `--verbose` output is not particularly helpful in this case. The
error is unrelated to what cargo is doing, and passing `--verbose` will
not give useful information about how to proceed. Additionally, it's
unclear that `--verbose` is referring to the cargo command and not
rustc; this is especially true when cargo is wrapped by another build
system (such as Meson, x.py, or Make).

This omits the "run the command again with --verbose" output. --verbose
is still shown in `cargo build --help`, but it's not singled out above
all the other options.
2021-07-05 16:27:51 -04:00
Eric Huss 652c5d9d1f Update Windows env uppercase key check. 2021-07-05 10:10:51 -07:00
bors 3ebb5f15a9 Auto merge of #9649 - ehuss:edition2021-report-tweaking, r=alexcrichton
Adjust the edition2021 resolver diff report.

This makes some adjustments to the report given on `cargo fix --edition` when there are differences in the feature resolver.

- Tweak the wording to be clearer.
- Removed the "activated dependencies" differences. This doesn't actually work (dependencies aren't ever completely removed), and isn't all that interesting (since it would be duplicating the same information from the feature differences).
2021-07-02 20:35:38 +00: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
bors b0e2cc5b60 Auto merge of #9644 - ehuss:offline-and-frozen, r=alexcrichton
Adjust error message with offline and frozen.

Using --offline with --frozen when the lock file needed to be updated gave a confusing error message. This updates it to make it slightly clearer.

Closes #9572
2021-07-02 13:56:54 +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