Commit Graph

17362 Commits

Author SHA1 Message Date
Ed Page c9325c9bd9 refactor(toml): Move project tests next to each other 2024-04-15 13:32:17 -05:00
Ed Page 77f96f5c61 fix(toml): Simplify [project] warning 2024-04-15 13:32:17 -05:00
Ed Page 8181bc8274 refactor(toml): Delay project warnings until Edition is parsed 2024-04-15 13:32:17 -05:00
Ed Page bec36fce99 fix(update): Remove locking message for --precise
We aren't locking to latest.
We could customize the message for precise but it seemed a bit
excessive.
2024-04-15 13:00:34 -05:00
bors 9f8adffe2e Auto merge of #13754 - epage:resolve-type, r=weihanglo
feat(resolve): Tell the user the style of resovle done

### What does this PR try to resolve?

This is to help with https://github.com/rust-lang/cargo/issues/9930

Example changes:
```diff
-[LOCKING] 4 packages
+[LOCKING] 4 packages to latest compatible version
-[LOCKING] 2 packages
+[LOCKING] 2 packages to latest Rust 1.60.0 compatible versions
-[LOCKING] 2 packages
+[LOCKING] 2 packages to earliest compatible versions
```

Benefits
- The package count is of "added" packages and this makes that more
  logically clear
- This gives users transparency into what is happening, especially with
  - what rust-version is use
  - the transition to this feature in the new edition
  - whether the planned config was applied or not (as I don't want it to
    require an MSRV bump)
- Will make it easier in tests to show what changed
- Provides more motiviation to show this message in `cargo update` and
  `cargo install` (that will be explored in a follow up PR)

This does come at the cost of more verbose output but hopefully not too
verbose.  This is why I left off other factors, like avoid-dev-deps.

### How should we test and review this PR?

### Additional information
2024-04-15 17:49:32 +00:00
Ed Page e772fc93b4 feat(update): Include a Locking message 2024-04-15 12:36:36 -05:00
bors 624233b0ed Auto merge of #13659 - RalfJung:rustc-wrapper, r=ehuss
Make sure to also wrap the initial `-vV` invocation

Fixes https://github.com/rust-lang/cargo/issues/10885 and therefore helps unblock https://github.com/rust-lang/miri/issues/3422.

This ensures that the version info actually matches the compiler that will later be doing the builds.
2024-04-15 17:18:26 +00:00
bors d19d2bca88 Auto merge of #13757 - naglis:docs-update-gh-checkout-action-version, r=epage
docs: update `checkout` GitHub action version

### What does this PR try to resolve?

This PR updates the GitHub CI examples in The Cargo Book to use the latest version of the `actions/checkout` GitHub action, since using `actions/checkout@v3` (currently used in the examples) produces warnings about deprecated Node.js 16 (see also [GitHub Actions: Transitioning from Node 16 to Node 20](https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/) blog post).

Also, v4 is already used in the "Verifying `rust-version`" example:

a9f86addbc/src/doc/src/guide/continuous-integration.md?plain=1#L174
2024-04-15 14:17:30 +00:00
Naglis Jonaitis e9c7df3d0a docs: update `checkout` GitHub action version
Using `actions/checkout@v3` produces warnings about deprecated Node.js
16 (see also [1]).

Also, v4 is already used in the "Verifying `rust-version`" example[2].

[1]: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/
[2]: a9f86addbc/src/doc/src/guide/continuous-integration.md?plain=1#L174
2024-04-15 15:22:57 +03:00
bors a9f86addbc Auto merge of #13756 - dtolnay-contrib:testdoc, r=weihanglo
Recategorize cargo test's `--doc` flag under "Target Selection"

### What does this PR try to resolve?

In `cargo help test`, the `--doc` flag is listed under a section called "Target Selection" next to `--lib`, `--bin`, `--bins`, `--example`, `--examples`, `--test`, `--tests`, `--bench`, `--benches`, and `--all-targets`.

But in `cargo test --help`, it was instead listed in an "Options" section next to `--no-run`, `--message-format`, `--color`, etc, which seems less appropriate than "Target Selection".

### How should we test and review this PR?

- `cargo build --release`
- `cargo test --release --test testsuite -- cargo_test::help::case`
- `target/release/cargo test --help`
- `target/release/cargo help test` (unchanged)
2024-04-15 03:01:12 +00:00
David Tolnay afea119dff
Recategorize cargo test's --doc flag under "Target Selection" 2024-04-14 19:11:02 -07:00
Ed Page 1876326b6b feat(resolve): Tell the user the style of resovle done
This is to help with #9930

Example changes:
```diff
-[LOCKING] 4 packages
+[LOCKING] 4 packages to latest version
-[LOCKING] 2 packages
+[LOCKING] 2 packages to latest Rust 1.60.0 compatible versions
-[LOCKING] 2 packages
+[LOCKING] 2 packages to earliest versions
```

Benefits
- The package count is of "added" packages and this makes that more
  logically clear
- This gives users transparency into what is happening, especially with
  - what rust-version is use
  - the transition to this feature in the new edition
  - whether the planned config was applied or not (as I don't want it to
    require an MSRV bump)
- Will make it easier in tests to show what changed
- Provides more motiviation to show this message in `cargo update` and
  `cargo install` (that will be explored in a follow up PR)

This does come at the cost of more verbose output but hopefully not too
verbose.  This is why I left off other factors, like avoid-dev-deps.
2024-04-13 20:39:59 -05:00
Ed Page 2ff60a5fc2 test(resolve): Show minimal version output 2024-04-13 20:37:55 -05:00
bors 07ac23a71c Auto merge of #13753 - jw013:patch-1, r=weihanglo
Reword sentence describing workspace toml for clarity

Judging by the commit history, the original sentence was written before the `[patch]` and `[profile]` sections were added and since those sections do not go underneath the workspace table the original sentence needed to be updated.
2024-04-13 22:58:47 +00:00
jw013 341a4645cc
Reword sentence describing workspace toml for clarity
Judging by the commit history, the original sentence was written before the `[patch]` and `[profile]` sections were added and since those sections do not go underneath the workspace table the original sentence needed to be updated.
2024-04-13 12:45:08 -04:00
bors 29189d9908 Auto merge of #13751 - epage:msrv-docs, r=weihanglo
docs(ref): Update unstable docs for msrv-policy
2024-04-13 13:35:46 +00:00
bors 8dd6db4f12 Auto merge of #13748 - epage:kebab, r=weihanglo
refactor(config): Consistently use kebab-case

This shouldn't change the behavior but makes it safer if
- We add new fields where it will matter
- Copy/paste these for new structs

I did not change things related to the Index because we are already stuck with that case (whether we want it or not)

Came across this when working on #13540 and almost made the mistake of copying what was already there
2024-04-13 13:04:42 +00:00
Ed Page cb2bdea521 refactor(resolve): Pull put locking message 2024-04-12 20:41:51 -05:00
Ed Page 17a11e493c refactor(resolve): Give printing access to the workspace 2024-04-12 17:05:56 -05:00
bors 48eca1b164 Auto merge of #13750 - epage:death, r=weihanglo
test: Remove add/remove death tests

Seeing recent fialures on Windows
- #13748
- #13738
- #13740

and maybe more

The test was added in #12744.  It seems of limited utility because there are innumerable ways of adding new writes that aren't atomic and we can't test for them all.
Even this case, its limited.

See also https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Flaky.20test.3A.20.20-death.3A.3Akill_cargo_add_never_corrupts_cargo/near/432979594
2024-04-12 21:16:36 +00:00
Ed Page 30efa8d9c5 test: Remove add/remove death tests
Seeing recent fialures on Windows
- #13748
- #13738
- #13740

and maybe more

The test was added in #12744.  It seems of limited utility because there
are innumerable ways of adding new writes that aren't atomic and we
can't test for them all.
Even this case, its limited.

See also https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Flaky.20test.3A.20.20-death.3A.3Akill_cargo_add_never_corrupts_cargo/near/432979594
2024-04-12 16:06:15 -05:00
bors 91796b1828 Auto merge of #13743 - epage:msrv-implicit, r=weihanglo
feat(resolve): Fallback to 'rustc -V' for MSRV resolving

### What does this PR try to resolve?

This is part of #9930 and adds a fallback if the rust-version isn't set

### How should we test and review this PR?

Tests are added in a separate commit so people can see how the behavior changed.

### Additional information
2024-04-12 20:41:25 +00:00
Ed Page bb46cce363 refactor(config): Consistently use kebab-case
This shouldn't change the behavior but makes it safer if
- We add new fields where it will matter
- Copy/paste these for new structs

I did not change things related to the Index because we are already
stuck with that case (whether we want it or not)
2024-04-12 15:21:21 -05:00
Ed Page 079f4d12e3 docs(ref): Update unstable docs for msrv-policy 2024-04-12 15:07:13 -05:00
bors 7dc84a2d31 Auto merge of #13742 - epage:msrv-update, r=Muscraft
feat(cli): Add --ignore-rust-version to update/generate-lockfile

### What does this PR try to resolve?

This is part of #9930 and extends `--ignore-rust-version` to `cargo update` and `cargo generate-lockfile`

### How should we test and review this PR?

First commit sets up tests

### Additional information
2024-04-12 16:57:51 +00:00
bors 7ac5d58f36 Auto merge of #13735 - linyihai:package-no-match, r=epage
`cargo package -p no-exist` emitt  error when the -p `package` not found

### What does this PR try to resolve?

Fixes #13719

If `-p` is used, and the spec doesn't match any member, we emit an error  like `cargo publish -p` does.

### How should we test and review this PR?

The first commit add a test to show the issue, the next commit add the check logic to fix it.

### Additional information
2024-04-12 16:27:02 +00:00
bors 6208c52b4c Auto merge of #13741 - epage:msrv-ignore-help, r=Muscraft
fix(help): Generalize --ignore-rust-version

### What does this PR try to resolve?

This is part of #9930 and updates for the help to accommodate #13738 and adding `--ignore-rust-version` to `cargo update`  for when they are stable

This includes
- Moving `--ignore-rust-version` to be under the "Manifest options" header
- Generalizing the help description

### How should we test and review this PR?

### Additional information
2024-04-12 15:41:49 +00:00
Ralf Jung 8a7ba8f8d9 Also wrap the initial `-vV` invocation in the rustc_(workspace_)wrapper
Based on an earlier draft by oli-obk
2024-04-12 12:33:34 +02:00
Lin Yihai decbadb36f fix: `cargo package -p` includes all packages if no match is found 2024-04-12 10:57:58 +08:00
Lin Yihai ac7bf6eb19 test(package): `cargo package -p doesnt-exist` will package all packages in workspace 2024-04-12 10:57:35 +08:00
bors 7e31f62a80 Auto merge of #13744 - cuviper:ci-uncompressed, r=weihanglo
test: don't compress test registry crates

They are still nominally gzipped, but using `Compression::none()` makes
them consistent even across zlib and zlib-ng, and this fixes checksum
differences in the testsuite. There is a one-time update of all those
checksums to catch up with this change though.

r? `@weihanglo`
2024-04-11 22:48:34 +00:00
bors c375398f3b Auto merge of #13738 - epage:msrv, r=Muscraft
feat(reslve): Respect '--ignore-rust-version'

### What does this PR try to resolve?

This is a part of #9930.

### How should we test and review this PR?

I had considered several ways of implementing this.  I first looked at passing this into `ops::resolve*`.
.This would get a bit annoying with the function signature, so I considered moving it to a builder..
Each of the entry points is slightly different with different ownership needs, making it hard to have a common abstraction.
In doing this, I noticed we currently pass some state around to the resolver via `Workspace`, so I mirrored that.

The nice thing about this location is it provides a good place to hook in config and `package.resolve` so they affect this.

### Additional information
2024-04-11 22:12:03 +00:00
Josh Stone a70f23c50b test: don't compress test registry crates
They are still nominally gzipped, but using `Compression::none()` makes
them consistent even across zlib and zlib-ng, and this fixes checksum
differences in the testsuite. There is a one-time update of all those
checksums to catch up with this change though.
2024-04-11 14:58:42 -07:00
bors d4672087b3 Auto merge of #13740 - Muscraft:remove-rust-2024-compat, r=epage
refactor: Remove `rust_2024_compatibility` lint group

The `rust_2024_compatibility` lint group was added as a way to be compatible with `Rust`. This group is meant to be used when switching to the 2024 edition (usually enabled by `cargo fix --edition`). Since we are not going to be interacting with `cargo fix` in the standard way to fix edition lints, this group is not needed at this time. Removing this will (slightly) reduce the complexity of working on things for the 2024 edition.
2024-04-11 21:17:17 +00:00
Scott Schafer d77faa68af
refactor: Remove `rust_2024_compatibility` lint group 2024-04-11 14:36:30 -06:00
Ed Page 38718eaa93 feat(resolve): Fallback to 'rustc -V' for MSRV resolving 2024-04-11 14:40:52 -05:00
Ed Page b7b3874d09 refactor(resolve): Make it easier to extend MSRV logic 2024-04-11 14:38:02 -05:00
Ed Page a8e816b079 test(resolve): Show no-MSRV case 2024-04-11 14:36:50 -05:00
Ed Page c7d89c64f1 feat(cli): Add --ignore-rust-version to update/generate-lockfile 2024-04-11 14:27:57 -05:00
Ed Page c9de6eeeb2 test(resolve): Show update/generate-lockfile behavior 2024-04-11 14:18:10 -05:00
Ed Page a0ba72918a fix(help): Generalize --ignore-rust-version 2024-04-11 13:45:39 -05:00
Ed Page cd3d31b361 feat(reslve): Respect '--ignore-rust-version' 2024-04-11 12:56:53 -05:00
Ed Page 11448b44fe refactor(resolve): Abstract out MSRV policy tracking 2024-04-11 12:07:05 -05:00
Ed Page 789eda2b83 fix: Correct fn name in log statement 2024-04-11 11:40:33 -05:00
bors 74fd5bc730 Auto merge of #13731 - weihanglo:openssl, r=epage
chore: downgrade to openssl v1.1.1 (again)

Accidentally updated by <https://github.com/rust-lang/cargo/pull/13674>

See https://github.com/rust-lang/cargo/issues/13546#issuecomment-2047366361
2024-04-10 18:40:49 +00:00
Weihang Lo 686057bddd
chore: pin openssl-sys to `=0.9.92` 2024-04-10 13:48:46 -04:00
bors 40ce8ace29 Auto merge of #13728 - weihanglo:dedup-suggestion, r=epage
fix(cargo-fix): dont apply same suggestion twice
2024-04-10 16:50:17 +00:00
bors e366699d7f Auto merge of #13727 - weihanglo:patch, r=epage
refactor: make `resolve_with_previous` clearer
2024-04-10 16:19:21 +00:00
Weihang Lo 95edc06e5b
fix(rustfix): dont apply same suggestion twice
This assumes that if any of the machine applicable fixes in
a diagnostic suggestion is a duplicate, we should see the
entire suggestion as a duplicate.
2024-04-10 11:54:33 -04:00
Weihang Lo 5b05a3bb5a
test(rustfix): demonstrate duplicate suggestions 2024-04-10 11:53:37 -04:00