Skip to content

feat(resolver): Stabilize min-publish-age - #17335

Merged
weihanglo merged 1 commit into
rust-lang:masterfrom
epage:min-publish-age
Aug 28, 2026
Merged

feat(resolver): Stabilize min-publish-age#17335
weihanglo merged 1 commit into
rust-lang:masterfrom
epage:min-publish-age

Conversation

@epage

@epage epage commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

View all comments

FCP

What does this PR try to resolve?

To ensure dependencies have had a chance to be scanned, a user can set:

[registry]
global-min-publish-age = "7 days"

To force a critical update through, a user can

$ CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE=allow cargo update -p foo

That will be preserved within the lockfile.

To ensure users can observe what is going on and address concerns,

  • Locking messages notify of:
    • That min-publish-age is in use and what the age is if there is a single one
    • a newer, unpicked version is available and its age
    • a version is being used that is incompatible with min-publish-age (either through allow or an unchange dep shown through -v)
  • Error messages notify of:
    • a newer, unpicked version is available and its age
    • a compatible version requirement to downgrade to
    • how to use CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE

Fixes #17009

How to test and review this PR?

Items from the tracking issue:

  • deny precedence between this and incompatible-rust-version: we can always adjust this over time
  • cargo install behavior
    • there was some confusion over what was being stabilized due to edits that happened during the FCP that weren't noticed
    • resolver is defined as not affecting cargo install which this preserves, just like incompatible-rust-version
  • cargo update --breaking: this feature is being stabilized first and the other is being considered for removal (fix(update)!: Remove unstable --breaking #17333)

@rustbot rustbot added A-dependency-resolution Area: dependency resolution and the resolver A-documenting-cargo-itself Area: Cargo's documentation A-unstable Area: nightly unstable support A-workspaces Area: workspaces S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 7, 2026
@rustbot

rustbot commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @epage, @weihanglo
  • @epage, @weihanglo expanded to epage, weihanglo

@weihanglo weihanglo Aug 7, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before diving into other aspects of the stabilization, have we got any feedback for this using in CI / production?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I know of.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I did not see this answered, I can share my testing here.

I tested the min-publish-age feature as a system-wide default on Amazon Linux 2023 (x86_64 + arm64) VMs with rustc/cargo 1.100.0-nightly (2026-08-27).

Setup

  • rustc 1.100.0-nightly (e457a7b0d 2026-08-27) / cargo 1.100.0-nightly (e8cb624 2026-08-22)
  • System-wide /etc/cargo/config.toml with global-min-publish-age = "1 day"
  • Validated across 16 test scenarios including a real-world project build (Firecracker)

Findings

  1. cargo build --locked produces identical Cargo.lock with and without the cooldown. I diffed Cargo.lock byte-for-byte from Firecracker builds with vs without cooldown.
  2. Large dependency graphs can be processed. An 192-crate workspace (tokio + reqwest + axum) resolves and builds with no issues when the 1-day delay is active. The cooldown actively held back packages: Cargo reported Locking 160 packages to highest Rust 1.100.0-nightly compatible versions as of 24 hours ago. We still obtained a working dependency set.
  3. Project-local override work. .cargo/config.toml with global-min-publish-age = "0 days" overrides the system default.
  4. Upgrade/update path works. cargo update -p <crate> upgrades to the newest cooldown-compatible version. CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE=allow was accepted on this nightly for bypassing the policy.
  5. I find the diagnostic message is clear enough: Locking 7 packages to highest Rust 1.100.0-nightly compatible versions as of 24 hours ago -- having a UTC timestamp would be better if it's in logs, but that's fine.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly the kind of real world testing I was looking for. Thanks a lot for taking time to test and document it!

Comment thread doc/book/src/reference/config.md Outdated
Comment thread doc/book/src/reference/config.md
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

pull Bot pushed a commit to Mattlk13/cargo that referenced this pull request Aug 10, 2026
pull Bot pushed a commit to Mattlk13/cargo that referenced this pull request Aug 10, 2026
### What does this PR try to resolve?

As identified at
rust-lang#17335 (comment)

### How to test and review this PR?
weihanglo added a commit to weihanglo/cargo that referenced this pull request Aug 11, 2026
# `[registry]` vs `[registries.<name>]` per-key semantics

Review notes for [rust-lang#17335] (min-publish-age stabilization),
comparing how each config key behaves across the two tables.
Verified against PR head `7b009184` with repro tests in
`tests/testsuite/registry_table_confusion.rs`
and the PR's own `tests/testsuite/min_publish_age.rs`.

[rust-lang#17335]: rust-lang#17335 (comment)

| Key | `[registry]` | `[registries.crates-io]` | `[registries.<alt>]` | Evidence |
|---|---|---|---|---|
| `token` | works for crates.io; does **not** follow `registry.default` | **silently ignored** (config and `CARGO_REGISTRIES_CRATES_IO_TOKEN` env) | works | `registries_crates_io_token_ignored_for_crates_io`, `registry_token_does_not_follow_registry_default` |
| `credential-provider` | works for crates.io | **silently ignored** | works | `registries_crates_io_credential_provider_ignored` |
| `secret-key` / `secret-key-subject` | works for crates.io | silently ignored (same code path as `token`) | works | code: `src/util/auth/mod.rs:212` returns `[registry]` for crates.io before any name lookup |
| `min-publish-age` (new) | crates.io only; ignored for alt registries even with `registry.default` pointing at them | **honored; overrides `registry.min-publish-age`** | honored | `registry_alt_ignores_min_publish_age`, `registries_crates_io_overrides_registry_default` |
| `global-min-publish-age` (new) | fallback for **all** registries | silently ignored (not a `RegistryConfig` field) | silently ignored | code: `src/context/schema.rs:530` |
| `protocol` | silently ignored (not a `GlobalRegistryConfig` field) | honored | parsed but unused (`_protocol`) | code: `SourceId::crates_io_is_sparse` reads `registries.crates-io.protocol` only |
| `index` | hard error: "no longer supported" | silently ignored (`SourceId::alt_registry` short-circuits `crates-io`) | required; defines the registry | code: `check_registry_index_not_set`, `src/workspace/source_id.rs:296` |
| `default` | selects target registry for `publish`/`login`/`owner`/`yank` when `--registry`/`--index` absent | silently ignored | n/a | code: `src/util/command_prelude.rs:919` |
| `global-credential-providers` | fallback providers for **all** registries | silently ignored | silently ignored | code: `src/util/auth/mod.rs:57` |

Key asymmetries:

* `min-publish-age` is the first key where `[registries.crates-io]` both works
  and overrides its `[registry]` counterpart;
  for the auth keys, `[registries.crates-io]` is dead config.
* Auth resolves crates.io **by URL first** (`is_crates_io()`, `src/util/auth/mod.rs:212`);
  min-publish-age resolves **by name first** (`alt_registry_key()`, `src/resolver/version_prefs.rs:279`).
  A named mirror of crates.io's index gets `[registry]` credentials
  but `registries.<mirror>.min-publish-age`.
* `registries.<name>.global-min-publish-age` and `registry.protocol` are silent no-ops —
  the same "subtle `s` distinction" concern raised in
  [rust-lang#12334](rust-lang#12334 (comment)).
weihanglo added a commit to weihanglo/cargo that referenced this pull request Aug 12, 2026
# `[registry]` vs `[registries.<name>]` per-key semantics

Review notes for [rust-lang#17335] (min-publish-age stabilization),
comparing how each config key behaves across the two tables.
Verified against PR head `7b009184` with repro tests in
`tests/testsuite/registry_table_confusion.rs`
and the PR's own `tests/testsuite/min_publish_age.rs`.

[rust-lang#17335]: rust-lang#17335 (comment)

| Key | `[registry]` | `[registries.crates-io]` | `[registries.<alt>]` | Evidence |
|---|---|---|---|---|
| `token` | works for crates.io; does **not** follow `registry.default` | **silently ignored** (config and `CARGO_REGISTRIES_CRATES_IO_TOKEN` env) | works | `registries_crates_io_token_ignored_for_crates_io`, `registry_token_does_not_follow_registry_default` |
| `credential-provider` | works for crates.io | **silently ignored** | works | `registries_crates_io_credential_provider_ignored` |
| `secret-key` / `secret-key-subject` | works for crates.io | silently ignored (same code path as `token`) | works | code: `src/util/auth/mod.rs:212` returns `[registry]` for crates.io before any name lookup |
| `min-publish-age` (new) | crates.io only; ignored for alt registries even with `registry.default` pointing at them | **honored; overrides `registry.min-publish-age`** | honored | `registry_alt_ignores_min_publish_age`, `registries_crates_io_overrides_registry_default` |
| `global-min-publish-age` (new) | fallback for **all** registries | silently ignored (not a `RegistryConfig` field) | silently ignored | code: `src/context/schema.rs:530` |
| `protocol` | silently ignored (not a `GlobalRegistryConfig` field) | honored | parsed but unused (`_protocol`) | code: `SourceId::crates_io_is_sparse` reads `registries.crates-io.protocol` only |
| `index` | hard error: "no longer supported" | silently ignored (`SourceId::alt_registry` short-circuits `crates-io`) | required; defines the registry | code: `check_registry_index_not_set`, `src/workspace/source_id.rs:296` |
| `default` | selects target registry for `publish`/`login`/`owner`/`yank` when `--registry`/`--index` absent | silently ignored | n/a | code: `src/util/command_prelude.rs:919` |
| `global-credential-providers` | fallback providers for **all** registries | silently ignored | silently ignored | code: `src/util/auth/mod.rs:57` |

Key asymmetries:

* `min-publish-age` is the first key where `[registries.crates-io]` both works
  and overrides its `[registry]` counterpart;
  for the auth keys, `[registries.crates-io]` is dead config.
* Auth resolves crates.io **by URL first** (`is_crates_io()`, `src/util/auth/mod.rs:212`);
  min-publish-age resolves **by name first** (`alt_registry_key()`, `src/resolver/version_prefs.rs:279`).
  A named mirror of crates.io's index gets `[registry]` credentials
  but `registries.<mirror>.min-publish-age`.
* `registries.<name>.global-min-publish-age` and `registry.protocol` are silent no-ops —
  the same "subtle `s` distinction" concern raised in
  [rust-lang#12334](rust-lang#12334 (comment)).
@weihanglo weihanglo added the T-cargo Team: Cargo label Aug 12, 2026
@rustbot

This comment has been minimized.

@weihanglo

Copy link
Copy Markdown
Member

@rfcbot fcp merge T-cargo

This stabilizes rust-lang/rfcs#3923 the min-publish-age. See the PR description for details.

Drifts from the RFC:

  • registry.min-publish-age is removed. There are confusion between [registry] and [registries.crates-io] tables and to avoid adding more things onto the confusions, we defer the field.
  • cargo install not respecting min-publish-age. There was a miscommunication in the RFC over what was being stabilized due to edits that happened during the FCP that weren't noticed. [resolver] is defined as not affecting cargo install which this preserves, just like incompatible-rust-version.

@rust-rfcbot

rust-rfcbot commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

@weihanglo has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period An FCP proposal has started, but not yet signed off. disposition-merge FCP with intent to merge labels Aug 12, 2026
@rustbot

This comment has been minimized.

jdalton added a commit to jdalton/perry that referenced this pull request Aug 21, 2026
…td legs

Pins Rust to an exact nightly-2026-08-20 across every CI workflow (was
floating on dtolnay/rust-toolchain@stable). Nightly, not stable 1.98.0,
because -Zmin-publish-age -- the cargo dependency-resolution soak
feature .cargo/config.toml already configures -- is still nightly-only:
verified directly against a real 1.98.0 stable binary, which silently
ignores the config with a warning, and against the tracking issue
(rust-lang/cargo#17009), still open. The stabilization PR
(rust-lang/cargo#17335, open) targets Rust 1.100.0, due late September
2026 -- that's the concrete transition-to-stable target, matching
socket-wheelhouse's own canonical rust-toolchain.toml.

Drops the tvOS/visionOS/watchOS Tier-3 build legs entirely from
release-packages.yml -- the nightly + rust-src install steps, the
-Z build-std=core,std,panic_abort build branches, the tier3 matrix
field, and the staging step's per-platform artifact-copy loop.
-Z build-std remains unstable regardless of channel, so this removal
is independent of which channel the pin above uses. The
perry-ui-tvos/visionos/watchos crates stay in the workspace, and the
compiler's own auto-rebuild (perry compile --target tvos-simulator,
via a floating +nightly the end user must have installed -- see
crates/perry/src/commands/compile/link/build_and_run.rs and
crates/perry/src/commands/compile/optimized_libs/driver.rs) is
untouched and still exercised by test.yml's tvOS-sim doc-tests; only
release-packages.yml's build-and-ship leg for these three platforms is
gone.

Applies the newly-stabilized {f32,f64}::algebraic_{add,sub,mul,div,rem}
methods in perry-runtime/src/perf_histogram.rs's stddev() (Node's
perf_hooks Histogram) -- safe because it's an internal HdrHistogram-
bucketed statistic, not a value any spec requires bit-exact evaluation
order for.

Recorded in external-tools.json's rust entry as a soakBypass-adopted
version (published 2026-08-20, adopted 1 day later, removable
2026-08-27).

The newer pinned nightly also surfaces two classes of pre-existing
issues that were invisible under the previous floating stable, both
fixed here: Atomic::fetch_update was renamed to try_update (8 call
sites across gc/barrier, gc/poll_arm, gc/layout_tables,
gc/roots/stack_maps, arena/block -- a pure rename, verified against
the real try_update signature), and an expanded unused-import lint now
catches a redundant `use super::super::*;` sitting alongside `use
super::*;` in 33 files (6 in perry-codegen's node_core native table, 27
in perry-runtime's node_stream_constructors/object modules) -- deleted
each line and confirmed the workspace still builds and 1051 targeted
unit tests still pass.

Verified against the real toolchains, not just docs: installed
nightly-2026-08-20 and (earlier) stable 1.98.0 locally, confirmed
-Zmin-publish-age activates on the former and is silently ignored on
the latter, ran the exact CI `warnings` job commands
(cargo check -p perry --bins, and cargo check --workspace --all-targets
minus the host-incompatible UI crates) under the pinned nightly with
RUSTFLAGS=-D warnings -- both clean -- and ran the perf_histogram test
suite (including Node-oracle-comparison tests) -- all clean.

Addresses CodeRabbit's review: fixed stale "stable" wording in
release-packages.yml comments/step names (including two more Tier-3
mentions CodeRabbit's follow-up review caught in create-release and
publish-assets) and scoped CLAUDE.md's tvOS/visionOS/watchOS claim to
release-packages.yml specifically. Left two items as documented
follow-ups rather than in-scope fixes: the gc-ratchet.yml baseline's
recorded toolchain provenance (metadata only, not enforced by
gc_ratchet.py, needs a real profiling run to regenerate) and
test.yml's/driver.rs's floating +nightly for the Tier-3 auto-rebuild
feature (must track whatever nightly the end user has installed, not
this repo's CI-only pin).
proggeramlug pushed a commit to PerryTS/perry that referenced this pull request Aug 21, 2026
…td legs (#8550)

Pins Rust to an exact nightly-2026-08-20 across every CI workflow (was
floating on dtolnay/rust-toolchain@stable). Nightly, not stable 1.98.0,
because -Zmin-publish-age -- the cargo dependency-resolution soak
feature .cargo/config.toml already configures -- is still nightly-only:
verified directly against a real 1.98.0 stable binary, which silently
ignores the config with a warning, and against the tracking issue
(rust-lang/cargo#17009), still open. The stabilization PR
(rust-lang/cargo#17335, open) targets Rust 1.100.0, due late September
2026 -- that's the concrete transition-to-stable target, matching
socket-wheelhouse's own canonical rust-toolchain.toml.

Drops the tvOS/visionOS/watchOS Tier-3 build legs entirely from
release-packages.yml -- the nightly + rust-src install steps, the
-Z build-std=core,std,panic_abort build branches, the tier3 matrix
field, and the staging step's per-platform artifact-copy loop.
-Z build-std remains unstable regardless of channel, so this removal
is independent of which channel the pin above uses. The
perry-ui-tvos/visionos/watchos crates stay in the workspace, and the
compiler's own auto-rebuild (perry compile --target tvos-simulator,
via a floating +nightly the end user must have installed -- see
crates/perry/src/commands/compile/link/build_and_run.rs and
crates/perry/src/commands/compile/optimized_libs/driver.rs) is
untouched and still exercised by test.yml's tvOS-sim doc-tests; only
release-packages.yml's build-and-ship leg for these three platforms is
gone.

Applies the newly-stabilized {f32,f64}::algebraic_{add,sub,mul,div,rem}
methods in perry-runtime/src/perf_histogram.rs's stddev() (Node's
perf_hooks Histogram) -- safe because it's an internal HdrHistogram-
bucketed statistic, not a value any spec requires bit-exact evaluation
order for.

Recorded in external-tools.json's rust entry as a soakBypass-adopted
version (published 2026-08-20, adopted 1 day later, removable
2026-08-27).

The newer pinned nightly also surfaces two classes of pre-existing
issues that were invisible under the previous floating stable, both
fixed here: Atomic::fetch_update was renamed to try_update (8 call
sites across gc/barrier, gc/poll_arm, gc/layout_tables,
gc/roots/stack_maps, arena/block -- a pure rename, verified against
the real try_update signature), and an expanded unused-import lint now
catches a redundant `use super::super::*;` sitting alongside `use
super::*;` in 33 files (6 in perry-codegen's node_core native table, 27
in perry-runtime's node_stream_constructors/object modules) -- deleted
each line and confirmed the workspace still builds and 1051 targeted
unit tests still pass.

Verified against the real toolchains, not just docs: installed
nightly-2026-08-20 and (earlier) stable 1.98.0 locally, confirmed
-Zmin-publish-age activates on the former and is silently ignored on
the latter, ran the exact CI `warnings` job commands
(cargo check -p perry --bins, and cargo check --workspace --all-targets
minus the host-incompatible UI crates) under the pinned nightly with
RUSTFLAGS=-D warnings -- both clean -- and ran the perf_histogram test
suite (including Node-oracle-comparison tests) -- all clean.

Addresses CodeRabbit's review: fixed stale "stable" wording in
release-packages.yml comments/step names (including two more Tier-3
mentions CodeRabbit's follow-up review caught in create-release and
publish-assets) and scoped CLAUDE.md's tvOS/visionOS/watchOS claim to
release-packages.yml specifically. Left two items as documented
follow-ups rather than in-scope fixes: the gc-ratchet.yml baseline's
recorded toolchain provenance (metadata only, not enforced by
gc_ratchet.py, needs a real profiling run to regenerate) and
test.yml's/driver.rs's floating +nightly for the Tier-3 auto-rebuild
feature (must track whatever nightly the end user has installed, not
this repo's CI-only pin).
jdalton added a commit to jdalton/perry that referenced this pull request Aug 21, 2026
…td legs

Pins Rust to an exact nightly-2026-08-20 across every CI workflow (was
floating on dtolnay/rust-toolchain@stable). Nightly, not stable 1.98.0,
because -Zmin-publish-age -- the cargo dependency-resolution soak
feature .cargo/config.toml already configures -- is still nightly-only:
verified directly against a real 1.98.0 stable binary, which silently
ignores the config with a warning, and against the tracking issue
(rust-lang/cargo#17009), still open. The stabilization PR
(rust-lang/cargo#17335, open) targets Rust 1.100.0, due late September
2026 -- that's the concrete transition-to-stable target, matching
socket-wheelhouse's own canonical rust-toolchain.toml.

Drops the tvOS/visionOS/watchOS Tier-3 build legs entirely from
release-packages.yml -- the nightly + rust-src install steps, the
-Z build-std=core,std,panic_abort build branches, the tier3 matrix
field, and the staging step's per-platform artifact-copy loop.
-Z build-std remains unstable regardless of channel, so this removal
is independent of which channel the pin above uses. The
perry-ui-tvos/visionos/watchos crates stay in the workspace, and the
compiler's own auto-rebuild (perry compile --target tvos-simulator,
via a floating +nightly the end user must have installed -- see
crates/perry/src/commands/compile/link/build_and_run.rs and
crates/perry/src/commands/compile/optimized_libs/driver.rs) is
untouched and still exercised by test.yml's tvOS-sim doc-tests; only
release-packages.yml's build-and-ship leg for these three platforms is
gone.

Applies the newly-stabilized {f32,f64}::algebraic_{add,sub,mul,div,rem}
methods in perry-runtime/src/perf_histogram.rs's stddev() (Node's
perf_hooks Histogram) -- safe because it's an internal HdrHistogram-
bucketed statistic, not a value any spec requires bit-exact evaluation
order for.

Recorded in external-tools.json's rust entry as a soakBypass-adopted
version (published 2026-08-20, adopted 1 day later, removable
2026-08-27).

The newer pinned nightly also surfaces two classes of pre-existing
issues that were invisible under the previous floating stable, both
fixed here: Atomic::fetch_update was renamed to try_update (8 call
sites across gc/barrier, gc/poll_arm, gc/layout_tables,
gc/roots/stack_maps, arena/block -- a pure rename, verified against
the real try_update signature), and an expanded unused-import lint now
catches a redundant `use super::super::*;` sitting alongside `use
super::*;` in 33 files (6 in perry-codegen's node_core native table, 27
in perry-runtime's node_stream_constructors/object modules) -- deleted
each line and confirmed the workspace still builds and 1051 targeted
unit tests still pass.

Verified against the real toolchains, not just docs: installed
nightly-2026-08-20 and (earlier) stable 1.98.0 locally, confirmed
-Zmin-publish-age activates on the former and is silently ignored on
the latter, ran the exact CI `warnings` job commands
(cargo check -p perry --bins, and cargo check --workspace --all-targets
minus the host-incompatible UI crates) under the pinned nightly with
RUSTFLAGS=-D warnings -- both clean -- and ran the perf_histogram test
suite (including Node-oracle-comparison tests) -- all clean.

Addresses CodeRabbit's review: fixed stale "stable" wording in
release-packages.yml comments/step names (including two more Tier-3
mentions CodeRabbit's follow-up review caught in create-release and
publish-assets) and scoped CLAUDE.md's tvOS/visionOS/watchOS claim to
release-packages.yml specifically. Left two items as documented
follow-ups rather than in-scope fixes: the gc-ratchet.yml baseline's
recorded toolchain provenance (metadata only, not enforced by
gc_ratchet.py, needs a real profiling run to regenerate) and
test.yml's/driver.rs's floating +nightly for the Tier-3 auto-rebuild
feature (must track whatever nightly the end user has installed, not
this repo's CI-only pin).
@rustbot

This comment has been minimized.

Comment on lines +1330 to +1333
- An integer followed by "seconds", "minutes", "hours", "days", "weeks", or "months"
- `"0"` to allow all packages

Generally, `"0"`, `"N days"`, and `"N weeks"` will be used.

@tats-u tats-u Aug 25, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Is a "day" always 24 hours even when crossing a Daylight Saving Time boundary?
  • How about the additional ISO 8601 duration format support (e.g. "P7D")?
  • "1 day" (and other similar singular forms) is rejected in favor of "1 days". Singular quantifiers should be also allowed (SQL allows both FETCH FIRST 1 ROW ONLY and FETCH FIRST 1 ROWS ONLY).

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The definition of this friendly format is here. They are all fixed seconds. And both singular and plural forms are supported.

let factor = match right {
"second" | "seconds" => 1,
"minute" | "minutes" => 60,
"hour" | "hours" => 60 * 60,
"day" | "days" => 24 * 60 * 60,
"week" | "weeks" => 7 * 24 * 60 * 60,
"month" | "months" => 2_629_746, // average is 30.436875 days
_ => return None,

How about the additional ISO 8601 duration format support (e.g. "P7D")?

We can consider it, though extending this would also need to extend pre-existing cache.auto-clean-frequency format. We probably don't want to block the stabilization on that.

That said, I saw uv has done a great job documenting this. We probably could polish ours as well.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about the additional ISO 8601 duration format support (e.g. "P7D")?

Would appreciate if you dont mind opening a new issue for it!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let factor = match right {
"second" | "seconds" => 1,
"minute" | "minutes" => 60,
"hour" | "hours" => 60 * 60,
"day" | "days" => 24 * 60 * 60,
"week" | "weeks" => 7 * 24 * 60 * 60,
"month" | "months" => 2_629_746, // average is 30.436875 days
_ => return None,

Glad to see it. No problem.

this would also need to extend pre-existing cache.auto-clean-frequency format.

The above logic is shared by both options, isn't it?

We probably don't want to block the stabilization on that.

I see. You can go ahead with the current logic.

That said, I saw uv has done a great job documenting this. We probably could polish ours as well.

I hope we can adopt it in both options in the future.

Sorry for having bothered you.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good points. No worries and thank you!

@rustbot

This comment has been minimized.

To ensure dependencies have had a chance to be scanned, a user can set:
```toml
[registry]
global-min-publish-age = "7 days"
```
To force a critical update through, a user can
```console
$ CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE=allow cargo update -p foo
```
That will be preserved within the lockfile.

To ensure users can observe what is going on and address concerns,
- Locking messages notify of:
  - That min-publish-age is in use and what the age is if there is a
    single one
  - a newer, unpicked version is available and its age
  - a version is being used that is incompatible with min-publish-age
    (either through `allow` or an unchange dep shown through `-v`)
- Error messages notify of:
  - a newer, unpicked version is available and its age
  - a compatible version requirement to downgrade to
  - how to use `CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE`

Items from the tracking issue:
- `deny` precedence between this and `incompatible-rust-version`: we can
  always adjust this over time
- the `registry.min-publish-age` / `registries.*.min-publish-age` precedence rule: mimics credential providers
- `cargo install` behavior
  - there was some confusion over what was being stabilized due to edits
    that happened during the FCP that weren't noticed
  - `resolver` is defined as not affecting `cargo install` which this
    preserves, just like `incompatible-rust-version`
- `cargo update --breaking`: this feature is being stabilized first and
  the other is being considered for removal (rust-lang#17333)

Fixes rust-lang#17009
@rustbot

This comment has been minimized.

@epage
epage force-pushed the min-publish-age branch 2 times, most recently from b85c20a to 34440b3 Compare August 26, 2026 21:01
@rustbot

rustbot commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-rfcbot rust-rfcbot added finished-final-comment-period FCP complete to-announce and removed final-comment-period FCP — a period for last comments before action is taken labels Aug 28, 2026
@rust-rfcbot

Copy link
Copy Markdown
Collaborator

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

@weihanglo
weihanglo added this pull request to the merge queue Aug 28, 2026
Merged via the queue into rust-lang:master with commit 9a4bc90 Aug 28, 2026
29 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 28, 2026
@epage
epage deleted the min-publish-age branch August 28, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-dependency-resolution Area: dependency resolution and the resolver A-documenting-cargo-itself Area: Cargo's documentation A-unstable Area: nightly unstable support A-workspaces Area: workspaces disposition-merge FCP with intent to merge finished-final-comment-period FCP complete T-cargo Team: Cargo to-announce Z-min-publish-age Nightly: min-publish-age (RFC 3923)

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Tracking Issue for min-publish-age RFC 3923

7 participants