20267 Commits

Author SHA1 Message Date
Weihang Lo
8f80388a78
Mark cachelock tests that rely on interprocess blocking behaviour as unsupported on AIX. (#15734)
This PR marks several tests within cache_lock.rs as unsupported on the
AIX platform. The tests relies on flock() behaviour that is not
supported on AIX.
2025-07-08 15:47:06 +00:00
Uyiosa Iyekekpolor
bc43610058 mark cachelock tests that rely on interprocess blocking behaviour as unsuported on AIX 2025-07-08 10:09:25 -04:00
Weihang Lo
0322bdd37a
feat(publish): Stabilize multi-package publishing (#15636)
### What does this PR try to resolve?

A user will now be able to use flags like `--workspace` with `cargo
publish`.
`cargo package` will now also work with those flags without having to
pass `--no-verify --exclude-lockfile`.

Many release tools have come out that solve this problem. They will
still need a lot of the logic that went into that for other parts of the
release process.
However, a cargo-native solution allows for:
- Verification during dry-run
- Better strategies for waiting for the publish timeout

`cargo publish` is non-atomic at this time.
If there is a server side error, network error, or rate limit during the
publish, the workspace will be left in a partially published state.
Verification is done before any publishing so that won't affect things.
There are multiple strategies we can employ for improving this over
time, including
- atomic publish
- `--idempotent` (#13397)
- leave this to release tools to manage

This includes support for `--dry-run` verification. As release tools
didn't have a way to do this before, users may be surprised at how slow
this is because a `cargo build` is done instead of a `cargo check`. This
is being tracked in #14941.

This adds to `cargo package` the `--registry` and `--index` flags to
help with resolving dependencies when depending on a package being
packaged at that moment.
These flags are only needed when a `cargo package --workspace` operation
would have failed before due to inability to find a locally created
dependency.

Regarding the publish timeout, `cargo publish --workspace` publishes
packages in batches and we only timeout if nothing in the batch has
finished being published within the timeout, deferring the rest to the
next wait-for-publish. So for example, if you have packages `a`, `b`,
`c` then we'll wait up to 60 seconds and if only `a` and `b` were ready
in that time, we'll then wait another 60 seconds for `c`.

During testing, users ran into issues with `.crate` checksums:
- ~~#15647~~ Fixed for `cargo publish --dry-run` in #15711
  - But `cargo package` still has the problem
- #14396 (not been able to reproduce)
- #15622 (reproducible with consecutive `cargo publish` calls)

Fixes #1169
Fixes #10948

### How to test and review this PR?

By stabilizing this, Cargo's behavior becomes dependent on an overlay
registry.
When generating a lockfile or verifying a package, we overlay the
locally generated `.crate` files on top of the registry so the registry
appears as it would and everything works.
If there is a conflict with a version, the local version wins which is
important for the dry-run mode of release tools as they won't have
bumped the version yet.
Our concern for the overlay registry is dependency confusion attacks.
Considering this is not accessible for general user operations, this
should be fine.
2025-07-07 21:54:46 +00:00
Weihang Lo
463e483346
Update to Rust 2024 (#15732)
This updates all crates to Rust 2024.
2025-07-06 11:39:11 +00:00
Eric Huss
e24a9865ac Apply deprecated_safe_2024 2025-07-05 20:17:36 -07:00
Eric Huss
639143579a Bump crate versions 2025-07-05 19:57:28 -07:00
Eric Huss
2d02d5a203 Ignore rustfmt 2024 commit 2025-07-05 19:51:10 -07:00
Eric Huss
1ce8023626 Rustfmt 2024 2025-07-05 19:50:36 -07:00
Eric Huss
fb0c7c99cf Update all crates to 2024 edition 2025-07-05 19:39:17 -07:00
Eric Huss
9d710a98a1 Apply unsafe_op_in_unsafe_fn 2025-07-05 19:29:43 -07:00
Eric Huss
b637a5fe83 Apply impl_trait_overcaptures 2025-07-05 19:29:29 -07:00
Eric Huss
a0d1859575 Apply keyword_idents_2024 2025-07-05 19:29:09 -07:00
Eric Huss
24813db9da Apply missing_unsafe_on_extern 2025-07-05 19:28:38 -07:00
Eric Huss
1213fc652b Apply rust_2024_incompatible_pat 2025-07-05 19:27:01 -07:00
Weihang Lo
425af55326
Clarify package ID specifications in SBOMs are fully qualified (#15731)
### What does this PR try to resolve?

cargo-auditable 0.7.0 will use the unstable Cargo SBOM precursor files
if a user configures Cargo to generate the SBOM files. cargo-auditable
assumes that the package ID specifiers in Cargo SBOM files are fully
qualified.

We'd like to enforce this assumption in Cargo so we can keep our package
ID spec parsing simpler by not considering non-fully qualified package
ID specs. This PR updates the cargo docs to state where fully qualified
package ID specs are used, and also adds SBOMs to the existing `cargo
pkgid` test that is currently enforcing consistency between the various
usages of fully qualified package id specs.

Previously raised at [#t-cargo > sbom missing name, version, source @
💬](https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/sbom.20missing.20name.2C.20version.2C.20source/near/525443447)

### How to test and review this PR?

Change doesn't affect current behaviour.
2025-07-05 22:44:26 +00:00
Tom Fay
6713b1ad46 generalize cargo's use of fully qualified
rather than providing an exhaustive list
2025-07-05 21:58:47 +01:00
Tom Fay
c74fadc0e5 Enforce pkgid and sbom consistency
clarify fully qualified package ID usage in docs
2025-07-05 20:59:07 +01:00
Ed Page
1743cb890d
chore(deps): update cargo-semver-checks to v0.42.0 (#15730)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
|
[cargo-semver-checks](https://redirect.github.com/obi1kenobi/cargo-semver-checks)
| minor | `0.41.0` -> `0.42.0` |

---

### Release Notes

<details>
<summary>obi1kenobi/cargo-semver-checks (cargo-semver-checks)</summary>

###
[`v0.42.0`](https://redirect.github.com/obi1kenobi/cargo-semver-checks/compare/v0.41.0...v0.42.0)

[Compare
Source](https://redirect.github.com/obi1kenobi/cargo-semver-checks/compare/v0.41.0...v0.42.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Every minute ( * * * * * ) (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/rust-lang/cargo).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNy4yIiwidXBkYXRlZEluVmVyIjoiNDEuMTcuMiIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119-->
2025-07-05 16:41:32 +00:00
renovate[bot]
9b91ef09fe
chore(deps): update cargo-semver-checks to v0.42.0 2025-07-05 16:08:44 +00:00
Weihang Lo
848e5a23c0
test: Switch config tests to use snapshots (#15729)
### What does this PR try to resolve?

This is prep for updating `toml` which will change some of these error
messages

### How to test and review this PR?
2025-07-05 15:38:48 +00:00
Ed Page
3488e267ee test: Switch config tests to use snapshots 2025-07-05 10:04:44 -05:00
Ed Page
e4162389d6
implement package feature unification (#15684)
### What does this PR try to resolve?

Implements another part of feature unification (#14774,
[rfc](1c590ce05d/text/3692-feature-unification.md)).
The `workspace` option was implemented in #15157, this adds the
`package` option.

### How to test and review this PR?

The important change is changing `WorkspaceResolve` so it can contain
multiple `ResolvedFeature`s. Along with that, it also needs to know
which specs those features are resolved for. This was used in several
other places:
- `cargo fix --edition` (from 2018 to 2021) - I think it should be ok to
disallow using `cargo fix --edition` when someone already uses this
feature.
- building std - it should be safe to assume std is not using this
feature so I just unwrap there. I'm not sure if some attempt to later
feature unification would be better.
- `cargo tree` - I just use the first feature set. This is definitely
not ideal, but I'm not entirely sure what's the correct solution here.
Printing multiple trees? Disallowing this, forcing users to select only
one package?

Based on comments in #15157 I've added tests first with `selected`
feature unification and then changed that after implementation. I'm not
sure if that's how you expect the tests to be added first, if not, I can
change the history.

I've expanded the test checking that this is ignored for `cargo install`
although it should work the same way even if it is not ignored
(`selected` and `package` are the same thing when just one package is
selected).
2025-07-02 19:44:20 +00:00
Eric Huss
eba6d5b032
chore: Upgrade dependencies (#15722)
### What does this PR try to resolve?

Replaces #15718, #15719

### How to test and review this PR?
2025-07-01 23:31:34 +00:00
David Mládek
e4a616b6fd docs: fix outdated doc comment 2025-07-02 00:01:52 +02:00
David Mládek
0be420bb78 docs: update unstable docs on feature unificatin 2025-07-02 00:01:52 +02:00
David Mládek
70f16f448b feat: add the package feature unification option 2025-07-02 00:01:52 +02:00
David Mládek
73b5b33e1d refactor(resolve): allow multiple resolved feature sets in workspace resolve 2025-07-02 00:01:52 +02:00
David Mládek
403f1e12f6 tests: add future package feature unification tests 2025-07-02 00:01:51 +02:00
Ed Page
714157308b
Report valid file name when we can't find a build target for name = "foo.rs" (#15707)
fixes #15703
2025-07-01 20:49:34 +00:00
Marijn Schouten
6eb5adcc50 bad_config: replace cargo build with cargo check 2025-07-01 19:55:58 +00:00
Marijn Schouten
e2987afda7 move config tests from build.rs to bad_config.rs 2025-07-01 18:58:41 +00:00
Marijn Schouten
87a24aa734 better msg for bug #15703 2025-07-01 18:53:33 +00:00
Ed Page
d8975d2901 chore: Update incompatible versions 2025-07-01 13:51:18 -05:00
Ed Page
72837912b4 chore: Update compatible versions 2025-07-01 13:50:44 -05:00
Marijn Schouten
81c233badd target_path_not_found_error_message: simplify 2025-07-01 08:12:00 +00:00
Marijn Schouten
56602aacd1 fix bug #15703 2025-07-01 08:06:47 +00:00
Marijn Schouten
01850417d7 add test for bug #15703 2025-07-01 07:35:27 +00:00
Ed Page
aaeb634d9a
chore(release): Publish build-rs on release (#15708)
### What does this PR try to resolve?

I know that us not publishing `build-rs` recently came up and was
surprised to see this wasn't fixed. Unsure where that conversation is or
what happened with it.

Looks like it was in #15567 and there was no follow up on my side...

### How to test and review this PR?
2025-06-30 20:51:29 +00:00
Ed Page
f013ef54bb
Override Cargo.lock checksums when doing a dry-run publish (#15711)
Fixes #15647.

When dry-run publishing workspace without bumping versions first, the
package-verification step would fail because it would see checksum
mismatches between the old lock file (that saw index deps) and the new
lock file where those index deps got replaced by local packages with the
same version.

In this PR, the packaging step modifies the old lock file's checksums
before re-resolving, but only in dry-run mode.
2025-06-30 20:20:41 +00:00
Ed Page
4a137fa64d
test(rustfix): Update for nightly (#15717)
### What does this PR try to resolve?

This unblocks Red CI, see [#t-cargo > Red CI: rustfix @
💬](https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/Red.20CI.3A.20rustfix/near/526449337)

### How to test and review this PR?

Inspired by #15713
2025-06-30 19:09:45 +00:00
Ed Page
e8a9510f11 chore(rustfix): Bump to 0.9.2 2025-06-30 13:37:27 -05:00
Ed Page
dca5d6409c test(rustfix): Update for nightly
Inspired by #15713
2025-06-30 13:17:09 -05:00
Ed Page
c8bf4096de feat(publish): Stabilize multi-package publishing
A user will now be able to use flags like `--workspace` with `cargo
publish`.
`cargo package` will now also work with those flags without having to
pass `--no-verify --exclude-lockfile`.

Many release tools have come out that solve this problem.
They will still need a lot of the logic that went into that for other
parts of the release process.
However, a cargo-native solution allows for:
- Verification during dry-run
- Better strategies for waiting for the publish timeout

`cargo publish` is non-atomic at this time.
If there is a server side error, network error, or rate limit during the publish,
the workspace will be left in a partially published state.
Verification is done before any publishing so that won't affect things.
There are multiple strategies we can employ for improving this over time,
including
- atomic publish
- `--idempotent` (#13397)
- leave this to release tools to manage

This includes support for `--dry-run` verification.
As release tools didn't have a way to do this before,
users may be surprised at how slow this is because a `cargo build` is
done instead of a `cargo check`.  This is being tracked in #14941.

This adds to `cargo package` the `--registry` and `--index` flags to
help with resolving dependencies when depending on a package being
packaged at that moment.
These flags are only needed when a `cargo package --workspace` operation
would have failed before due to inability to find a locally created
dependency.

Regarding the publish timeout, `cargo publish --workspace` publishes
packages in batches and we only timeout if nothing in the batch has
finished being published within the timeout, deferring the rest to the
next wait-for-publish. So for example, if you have packages `a`, `b`, `c` then
we'll wait up to 60 seconds and if only `a` and `b` were ready in that time,
we'll then wait another 60 seconds for `c`.

During testing, users ran into issues with `.crate` checksums that we've
not been able to reproduce since:
- https://github.com/rust-lang/cargo/issues/1169#issuecomment-2567995987
- #14396

By stabilizing this, Cargo's behavior becomes dependent on an overlay
registry.
When generating a lockfile or verifying a package, we overlay the
locally generated `.crate` files on top of the registry so the registry
appears as it would and everything works.
If there is a conflict with a version, the local version wins which is
important for the dry-run mode of release tools as they won't have
bumped the version yet.
Our concern for the overlay registry is dependency confusion attacks.
Considering this is not accessible for general user operations, this
should be fine.

Fixes #1169
Fixes #10948
2025-06-30 09:27:59 -05:00
Ed Page
930b4f62cf
Use a different lint for the fix_only_once_for_duplicates test (#15713)
### What does this PR try to resolve?

This PR changes the triggering `rustc` lint in the
`fix_only_once_for_duplicates` test from `unused_must_use` to
`forgetting_references`, because we are changing in
https://github.com/rust-lang/rust/pull/143030 the interaction between
that lint and macros.

This is required as it blocking the rust PR,
https://github.com/rust-lang/rust/pull/143030#issuecomment-3009124056.

### How to test and review this PR?

Look at the test changes.
2025-06-28 14:58:43 +00:00
Urgau
c5fee7d595 Use a different lint for the ffix_only_once_for_duplicates test 2025-06-28 14:29:29 +02:00
Joe Neeman
340a4f9bbd Add a dry-run packaging mode that munges checksums 2025-06-27 14:48:04 -05:00
Joe Neeman
95e961b4a0 Add a test showing the changed checksum. 2025-06-27 13:49:14 -05:00
Ed Page
37ac0c28b8
chore: bump to 0.91.0; update changelog (#15710) 2025-06-27 16:27:06 +00:00
Ed Page
96c6d7b9c2
Add http.proxy-cainfo config for proxy certs (#15374)
This adds a `http.proxy-cainfo` option to Cargo which reads CA
information from a bundle to pass through to the underlying `libcurl`
call. This should allow configuration of Cargo in situations where SSL
proxy is used.

Similar to https://github.com/rust-lang/cargo/pull/2917.
cc #15376
2025-06-27 16:17:30 +00:00
Eric Huss
57dbb7f2c3
Update changelog wording from suggestions
Co-authored-by: Ed Page <eopage@gmail.com>
2025-06-27 08:58:09 -07:00