7275 Commits

Author SHA1 Message Date
Ed Page
a7be79bca8
refactor: clean up clippy::perf lint warnings (#15631)
### What does this PR try to resolve?

The `clippy::perf` lint group is fairly useful for catching bad
practices that might hurt performance marginally.

This PR fixes most of them except `clippy::large_enum_variant`, which
doesn't feel right at this moment and need more researches. And that is
why I didn't enable the lint group.

### How to test and review this PR?
2025-06-04 21:53:19 +00:00
Weihang Lo
c3409d5425
refactor: clean up clippy::perf lint warnings
The `clippy::perf` lint group is fairly useful for catching bad
practices that might hurt performance marginally.

This PR fixes most of them except `clippy::large_enum_variant`,
which doesn't feel right at this moment and need more researches.

Anyway, overall this PR should be good.
2025-06-04 14:23:12 -07:00
Ed Page
094ef50e94 fix(package): Skip registry check if its not needed
I believe this brings makes it so `cargo package -Zpackage-workspace` no longer has a
behavior change compared to `cargo package`.
2025-06-04 13:21:12 -05:00
Ed Page
4a92ad1241 test(package): Better characterize the -Zpackage-workspace behavior change 2025-06-04 13:08:59 -05:00
Ed Page
68f0c653ca test(package): Show stable behavior for -Zpackage-workspace 2025-06-04 12:59:10 -05:00
Ed Page
d6cc0fb192 test(package): Prep for forking tests for stable 2025-06-04 12:46:35 -05:00
Ed Page
0d391bd86c test(publish): Make package_selection tests consistent 2025-06-03 19:46:33 -05:00
Ed Page
103b13d858 test(publish): Split package_selection into nightly/stable 2025-06-03 19:45:19 -05:00
Ed Page
6061553bf1 test(publish): Use proper registry for workspace tests
On stabilization of `-Zpackage-workspace`, these will start passing and
will need a full registry
2025-06-03 19:42:40 -05:00
Ed Page
8a9d8bde7a
fix(package): Allow packaging of self-cycles with -Zpackage-workspace (#15626)
### What does this PR try to resolve?

Found this as I was preparing for stabilization.

As we create a graph of packages to ensure publish order, a self-cycle
shouldn't matter, so we can skip tracking it.

### How to test and review this PR?
2025-06-04 13:27:02 +00:00
Ed Page
876c9fb802 fix(package): Allow packaging of self-cycles with -Zpackage-workspace 2025-06-03 20:03:02 -05:00
Ed Page
27c39b6597 test(package): Show nightly self-dep behavior 2025-06-03 19:58:18 -05:00
Weihang Lo
281629bd2b
fix(trim-paths): remap all paths to build.build-dir
Remap all paths pointing to `build.build-dir`,
i.e., `[BUILD_DIR]/debug/deps/foo-[HASH].dwo` would be remapped to
`/cargo/build-dir/debug/deps/foo-[HASH].dwo`
(note the `/cargo/build-dir` prefix).

This covers scenarios like:

* Build script generated code. For example, a build script may call `file!`
  macros, and the associated crate uses [`include!`] to include the expanded
  [`file!`] macro in-place via the `OUT_DIR` environment.
* On Linux, `DW_AT_GNU_dwo_name` that contains paths to split debuginfo
  files (dwp and dwo).
2025-06-02 14:26:36 -04:00
Weihang Lo
463e9ed3cd
test(trim-paths): not remapped in build script gen'd code
This was discovered in
<https://github.com/rust-lang/rust/issues/111540#issuecomment-2544049895>.

Co-authored-by: Urgau <urgau@numericable.fr>
2025-06-02 14:26:35 -04:00
Weihang Lo
56a1118e52
test(trim-paths): match the actual sanitized paths
The old wildcard matched too much and didn't really
show whether the paths were sanitized.
2025-06-02 14:26:35 -04:00
Weihang Lo
d8ac8dd2e5
test(trim-paths): re-enable more symbols trimming check
rust-lang/rust#117652 has been fixed.
2025-06-02 14:26:35 -04:00
Ed Page
b646f83935
test(trim-paths): enable more tests for windows-msvc (#15621)
### What does this PR try to resolve?

Before this some end-to-end tests didn't cover Windows platforms.

After this, we cover windows-msvc for

* End-to-end debugger tests.
* Check path is trimmed with symbol viewers like `strings`.

windows-gnu isn't covered

### How to test and review this PR?

There are things needing attentions:

* This adds a new CI job for window-msvc "nightly" toolchain.
* In 2f923b3ff25f847d we don't check if an executable's availability by
running `<cmd> --version`. Instead, we check the file execute bit.
* Enabled windows-msvc tests rely on the software provided by [GitHub
windows runner
image](e330e24b7e/images/windows/Windows2022-Readme.md)
  * Windows SDK which provides cdb and other debugger tools
  * `strings` is provided by MinGW.
2025-06-02 17:17:38 +00:00
Weihang Lo
4e507121a0
test(trim-paths): verify trim-paths=object works on windows-msvc 2025-06-02 08:10:24 -04:00
Weihang Lo
11e40ae867
test(trim-paths): verify Windows cdb works after trimmed
GitHub Actions has Windows SDK pre-installed,
so cdb should be available at that path always.

Additionally, this adds a new CI job for windows-msvc nightly toolchain
2025-06-02 08:10:24 -04:00
Weihang Lo
d7940042bd
Fix cargo add overwriting symlinked Cargo.toml files (#15281)
### What does this PR try to resolve?

This PR fixes a bug where `cargo add` breaks symlinks to Cargo.toml
files. Currently, when Cargo.toml is a symlink and `cargo add` is used
to add a dependency, the symlink is replaced with a regular file,
breaking the link to the original target file.

This issue was reported in #15241 where a user who relies on symlinked
Cargo.toml files found that `cargo add` breaks their workflow.

Fixes #15241

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

I've modified `LocalManifest::write()` to check if the path is a
symlink, and if so, follow it to get the actual target path. This
ensures we write to the actual file rather than replacing the symlink.

I've also added a test in `tests/testsuite/cargo_add/symlink.rs` that:
1. Creates a symlinked Cargo.toml file
2. Runs `cargo add` to add a dependency
3. Verifies the symlink is preserved and the dependency is added to the
target file

I've manually tested this fix and confirmed it works correctly.
2025-06-02 10:23:52 +00:00
Raghavender Singh
ecfe3a961d fix: handle symlinks properly in write_atomic
- Preserve symlinks when writing files atomically in write_atomic()
- Update test to verify correct symlink preservation behavior
- Apply rustfmt formatting

This fixes the issue where cargo add would replace symlinked Cargo.toml
files with regular files, breaking the symlink to the original target.

Fixes #15241
2025-06-02 10:26:42 +05:30
Weihang Lo
8a388b0392
test(test): ensure panic=abort not added to default example inclusion
`cargo test` will implicitly build examples as examples binaries
(without --test) by default, when no target selection flags provided.
We don't have test exercising this, so add one.
2025-05-29 20:45:47 -04:00
Raghavender Singh
35d2a30a5c test: Add test demonstrating cargo add replaces symlinks
This test shows the current behavior where cargo add replaces
symlinked Cargo.toml files with regular files. The test passes,
documenting this problematic behavior.
2025-05-30 00:25:18 +05:30
Weihang Lo
2bab011078
refactor: separate "global" mode from CompileMode
This separates the concern of two different "mode".

- UserIntent: focus on the overall goal of the build
- CompileMode: the actual compile operation for each unit

This is a preparation of adding `-Zno-link`/`-Zlink-only` support,
which we'll have `CompileMode::Link` but that doesn't make sense to
show up in `UserIntent`.
2025-05-27 11:48:30 -04:00
Eric Huss
21629670f4 Implement -Zfix-edition
This adds the implementation for the behavior of `cargo fix
-Zfix-edition`.
2025-05-25 08:24:09 -07:00
Eric Huss
9d93b42c4c Add the -Zfix-edition flag
This adds support for parsing the `-Zfix-edition` flag.
2025-05-25 08:18:41 -07:00
Eric Huss
5f5ad05d80 Add the future edition
This adds support for the "future" edition which was added to rustc in
https://github.com/rust-lang/rust/pull/137606.

To enable support for unstable editions, this introduces a new
`unstable-editions` cargo feature. The intent is that instead of having
a new feature for each edition that we reuse this feature for all new
editions. I don't see a particular reason we should have a separate one
for each edition, and this helps a bit with scalability and simplifies
some of the edition process.

This also includes a change to rework `supports_compat_lint` explained
in the comment.
2025-05-24 17:36:32 -07:00
Weihang Lo
c2c636a6db
fix(toml): Remove workaround for rustc frontmatter support (#15570)
### What does this PR try to resolve?

With rust-lang/rust#140035 now merged, we can rely on that rather than
dirty hacks

This is part of #12207

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

### Additional information
2025-05-21 23:45:57 +00:00
Ed Page
f49d2fdbb4 fix(toml): Remove workaround for rustc frontmatter support
With rust-lang/rust#140035 now merged, we can rely on that rather than
dirty hacks
2025-05-21 12:48:56 -05:00
Weihang Lo
29ecb7f36a
fix(vendor)!: vendor files with .rej/.orig suffix
This is meant to fixes #13191

As git sources and registry sources are considered immutable.
I don't think there is any reason excluding those files.
There might be a little chance local Git repositories might have those,
though that is a rare use case.

Alternatively,
we could reject all `.rej`/`.orig` files but `Cargo.toml.orig`.
2025-05-21 13:17:16 -04:00
Weihang Lo
622d4c2506
test(vendor): make what to vendor clearer 2025-05-21 13:16:48 -04:00
Weihang Lo
dd4c8c0e2a
test(vendor): snapshot .cargo-checksum.json
So that it explicitly shows what we really vendor
2025-05-21 13:03:04 -04:00
Ed Page
ee08992ec9
fix(vendor)!: direct extraction for registry sources (#15514)
### What does this PR try to resolve?

`PathSource::list_files` has some heurstic rules for listing files.
Those rules are mainly designed for `cargo package`.

Previously, cargo-vendor relies on those rules to understand what files
to vendor. However, it shouldn't use those rules because:

* Package extracted from a `.crate` tarball isn't Git-controlled, some
rules may apply differently.
* The extracted package already went through `PathSource::list_files`
during packaging. It should be clean enough.
* Should keep crate sources from registry sources in a pristine state,
which is exactly what vendoring is meant for.

Instead, we switch to direct extraction into the vendor directory
to ensure source code is the same as in the `.crate` tarball.

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

There is already a test `vendor::package_exclude` for the fix of #9054,
though now I think it is not a good fix. The test change shows the
correct behavior change.

I am not sure if we want more tests.

Also, there are some caveats with this fix:

* The overwrite protection in `unpack_package` assumes the unpack
  directory is always `<pkg>-<version`>.
  We don't want to remove this,
  but for cargo-vendor supports vendoring without version suffix.
  For that case, we need a temporary staging area,
  and move the unpacked source then.
* The heurstic in `PathSource::list_files` did something "good" in
  general cases, like excluding hidden directories. That means
  common directories like `.github` or `.config` won't be vendored.
  After this, those get included. This is another round of churns.
  We might want to get other `cargo-vendor` changes along with this
  in one single release.

### Additional information

* Fixes #9054
* Fixes #9555
* Fixes #9575
* Fixes #11000
* Fixes #14034
* Fixes #15080
* Fixes #15090

This also opens a door for

* #10310
* #13191

Since we are changing vendored source (again), we might want to remove
the `.rej`/`.orig` special rules in cargo-vendor, as well as look into
the new source-dedup vendor dir layout.

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_SUMMARY_START -->

### Summary Notes

-
[benchmark-result](https://github.com/rust-lang/cargo/pull/15514#issuecomment-2870275766)
by [weihanglo](https://github.com/weihanglo)

Generated by triagebot, see
[help](https://forge.rust-lang.org/triagebot/note.html) for how to add
more
<!--
TRIAGEBOT_SUMMARY_DATA_START$${"entries_by_url":{"https://github.com/rust-lang/cargo/pull/15514#issuecomment-2870275766":{"title":"benchmark-result","comment_url":"https://github.com/rust-lang/cargo/pull/15514#issuecomment-2870275766","author":"weihanglo"}}}$$TRIAGEBOT_SUMMARY_DATA_END
-->

<!-- TRIAGEBOT_SUMMARY_END -->
<!-- TRIAGEBOT_END -->
2025-05-21 14:42:18 +00:00
Weihang Lo
e8534d0bc2
fix(vendor)!: direct extraction for registry sources
`PathSource::list_files` has some heurstic rules for listing files.
Those rules are mainly designed for `cargo package`.

Previously, cargo-vendor relies on those rules to understand what
files to vendor. However, it shouldn't use those rules because:

* Package extracted from a `.crate` tarball isn't Git-controlled,
  some rules may apply differently.
* The extracted package already went through `PathSource::list_files`
  during packaging. It should be clean enough.
* Should keep crate sources from registry sources in a pristine state,
  which is exactly what vendoring is meant for.

Instead, we switch to direct extraction into the vendor directory
to ensure source code is the same as in the `.crate` tarball.

There are some caveats:

* The overwrite protection in `unpack_package` assumes the unpack
  directory is always `<pkg>-<version`>.
  We don't want to remove this,
  but for cargo-vendor supports vendoring without version suffix.
  For that case, we need a temporary staging area,
  and move the unpacked source then.
* The heurstic in `PathSource::list_files` did something "good" in
  general cases, like excluding hidden directories. That means
  common directorys like `.github` or `.config` won't be vendored.
  After this, those get included. This is another round of churns.
  We might want to get other `cargo-vendor` changes along with this
  in one single release.
2025-05-21 10:07:41 -04:00
Weihang Lo
c36e6f258e
fix: remove unnecessary workaround in standard_lib test (#15522)
### What does this PR try to resolve?

- As issue https://github.com/rust-lang/rust/issues/125246 has already
been fixed, there must be no need for commenting out `--sysroot` anymore
in the tests.

- The bug mentioned in `shared_std_dependency_rebuild()` looks to be
already solved and does not reproduce. So I guess it's safe to
un-comment those lines.
2025-05-20 11:45:38 +00:00
motorailgun
ff1849fc54 fix: remove unnecessary workaround in standard_lib test 2025-05-20 08:23:34 +00:00
Eric Huss
cbdb9f0620 Update dependencies
Routine update of dependencies.

Tempfile is updated since it is generating a deprecation due to a method
rename.

I presume the help output change is due to an update in clap.

Handlebars is not updated due to
https://github.com/sunng87/handlebars-rust/issues/711

Updating ahash v0.8.11 -> v0.8.12
Updating anyhow v1.0.96 -> v1.0.98
Updating base64ct v1.6.0 -> v1.7.3
Updating bitflags v2.8.0 -> v2.9.1
Updating blake3 v1.6.1 -> v1.8.2
Updating bstr v1.11.3 -> v1.12.0
Updating bytes v1.10.0 -> v1.10.1
Updating cargo_metadata v0.19.1 -> v0.19.2
Updating cc v1.2.16 -> v1.2.23
Updating clap v4.5.31 -> v4.5.38
Updating clap_builder v4.5.31 -> v4.5.38
Updating clap_complete v4.5.46 -> v4.5.50
Updating ct-codecs v1.1.3 -> v1.1.5
Updating darling v0.20.10 -> v0.20.11
Updating darling_core v0.20.10 -> v0.20.11
Updating darling_macro v0.20.10 -> v0.20.11
Updating der v0.7.9 -> v0.7.10
Updating deranged v0.3.11 -> v0.4.0
Updating dyn-clone v1.0.18 -> v1.0.19
Updating either v1.13.0 -> v1.15.0
Updating equivalent v1.0.1 -> v1.0.2
Updating erased-serde v0.4.5 -> v0.4.6
Updating errno v0.3.10 -> v0.3.12
Updating escargot v0.5.13 -> v0.5.14
  Adding faster-hex v0.10.0
Updating ff v0.13.0 -> v0.13.1
Updating foldhash v0.1.4 -> v0.1.5
Removing getrandom v0.2.15
Removing getrandom v0.3.1
  Adding getrandom v0.2.16
  Adding getrandom v0.3.3
Updating git2 v0.20.0 -> v0.20.2
Removing gix-features v0.41.0
  Adding gix-features v0.41.1
  Adding gix-features v0.42.1
  Adding gix-fs v0.15.0
  Adding gix-hash v0.18.0
Updating gix-hashtable v0.8.0 -> v0.8.1
Updating gix-lock v17.0.0 -> v17.1.0
Updating gix-path v0.10.15 -> v0.10.18
Updating gix-tempfile v17.0.0 -> v17.1.0
  Adding gix-utils v0.3.0
  Adding gix-validate v0.10.0
Updating globset v0.4.15 -> v0.4.16
Updating half v2.4.1 -> v2.6.0
  Adding hash32 v0.3.1
Updating hashbrown v0.15.2 -> v0.15.3
  Adding heapless v0.8.0
Updating hermit-abi v0.4.0 -> v0.5.1
Updating icu_collections v1.5.0 -> v2.0.0
  Adding icu_locale_core v2.0.0
Removing icu_locid v1.5.0
Removing icu_locid_transform v1.5.0
Removing icu_locid_transform_data v1.5.0
Updating icu_normalizer v1.5.0 -> v2.0.0
Updating icu_normalizer_data v1.5.0 -> v2.0.0
Updating icu_properties v1.5.1 -> v2.0.0
Updating icu_properties_data v1.5.0 -> v2.0.0
Updating icu_provider v1.5.0 -> v2.0.0
Removing icu_provider_macros v1.5.0
Updating idna_adapter v1.2.0 -> v1.2.1
Updating indexmap v2.7.1 -> v2.9.0
Updating is-terminal v0.4.15 -> v0.4.16
Updating itoa v1.0.14 -> v1.0.15
Updating jiff v0.2.3 -> v0.2.13
Updating jiff-static v0.2.3 -> v0.2.13
Updating jiff-tzdb v0.1.2 -> v0.1.4
Updating jiff-tzdb-platform v0.1.2 -> v0.1.3
Updating jobserver v0.1.32 -> v0.1.33
Updating libc v0.2.170 -> v0.2.172
Updating libgit2-sys v0.18.0+1.9.0 -> v0.18.1+1.9.0
Updating libloading v0.8.6 -> v0.8.7
Updating libz-sys v1.1.21 -> v1.1.22
  Adding linux-raw-sys v0.9.4
Updating litemap v0.7.4 -> v0.8.0
Updating log v0.4.25 -> v0.4.27
Updating miniz_oxide v0.8.5 -> v0.8.8
Updating once_cell v1.20.3 -> v1.21.3
Updating oorandom v11.1.4 -> v11.1.5
Updating openssl-src v300.4.2+3.4.1 -> v300.5.0+3.5.0
Updating openssl-sys v0.9.107 -> v0.9.108
Updating orion v0.17.8 -> v0.17.10
Updating os_info v3.10.0 -> v3.11.0
Updating pasetors v0.7.2 -> v0.7.4
Updating pest v2.7.15 -> v2.8.0
Updating pest_derive v2.7.15 -> v2.8.0
Updating pest_generator v2.7.15 -> v2.8.0
Updating pest_meta v2.7.15 -> v2.8.0
Updating pkg-config v0.3.31 -> v0.3.32
Updating portable-atomic v1.10.0 -> v1.11.0
  Adding potential_utf v0.1.2
Updating ppv-lite86 v0.2.20 -> v0.2.21
Updating proc-macro2 v1.0.93 -> v1.0.95
Updating prodash v29.0.1 -> v29.0.2
Updating quote v1.0.38 -> v1.0.40
  Adding r-efi v5.2.0
Updating rand v0.9.0 -> v0.9.1
Updating rand_core v0.9.0 -> v0.9.3
Updating redox_syscall v0.5.8 -> v0.5.12
Updating ref-cast v1.0.23 -> v1.0.24
Updating ref-cast-impl v1.0.23 -> v1.0.24
  Adding rustix v1.0.7
Updating rustversion v1.0.19 -> v1.0.20
Updating ryu v1.0.19 -> v1.0.20
Updating semver v1.0.25 -> v1.0.26
Updating serde v1.0.218 -> v1.0.219
Updating serde-untagged v0.1.6 -> v0.1.7
Updating serde_derive v1.0.218 -> v1.0.219
Updating serde_ignored v0.1.10 -> v0.1.12
Updating serde_json v1.0.139 -> v1.0.140
Updating sha2 v0.10.8 -> v0.10.9
Updating smallvec v1.13.2 -> v1.15.0
Updating socket2 v0.5.8 -> v0.5.9
Updating syn v2.0.98 -> v2.0.101
Updating synstructure v0.13.1 -> v0.13.2
Updating tempfile v3.17.1 -> v3.20.0
Updating terminal_size v0.4.1 -> v0.4.2
Updating thiserror v2.0.11 -> v2.0.12
Updating thiserror-impl v2.0.11 -> v2.0.12
Updating time v0.3.37 -> v0.3.41
Updating time-core v0.1.2 -> v0.1.4
Updating time-macros v0.2.19 -> v0.2.22
Updating tinystr v0.7.6 -> v0.8.1
Updating tinyvec v1.8.1 -> v1.9.0
Updating toml v0.8.20 -> v0.8.22
Updating toml_datetime v0.6.8 -> v0.6.9
Updating toml_edit v0.22.24 -> v0.22.26
  Adding toml_write v0.1.1
Updating typeid v1.0.2 -> v1.0.3
Updating typenum v1.17.0 -> v1.18.0
Updating unicode-ident v1.0.17 -> v1.0.18
Removing utf16_iter v1.0.5
Updating wasi v0.13.3+wasi-0.2.2 -> v0.14.2+wasi-0.2.4
  Adding windows-targets v0.53.0
  Adding windows_aarch64_gnullvm v0.53.0
  Adding windows_aarch64_msvc v0.53.0
  Adding windows_i686_gnu v0.53.0
  Adding windows_i686_gnullvm v0.53.0
  Adding windows_i686_msvc v0.53.0
  Adding windows_x86_64_gnu v0.53.0
  Adding windows_x86_64_gnullvm v0.53.0
  Adding windows_x86_64_msvc v0.53.0
Updating winnow v0.7.1 -> v0.7.10
Updating wit-bindgen-rt v0.33.0 -> v0.39.0
Removing write16 v1.0.0
Updating writeable v0.5.5 -> v0.6.1
Updating yoke v0.7.5 -> v0.8.0
Updating yoke-derive v0.7.5 -> v0.8.0
Removing zerocopy v0.7.35
Removing zerocopy v0.8.17
  Adding zerocopy v0.8.25
Removing zerocopy-derive v0.7.35
Removing zerocopy-derive v0.8.17
  Adding zerocopy-derive v0.8.25
Updating zerofrom v0.1.5 -> v0.1.6
Updating zerofrom-derive v0.1.5 -> v0.1.6
  Adding zerotrie v0.2.2
Updating zerovec v0.10.4 -> v0.11.2
Updating zerovec-derive v0.10.3 -> v0.11.1
2025-05-17 19:32:32 -07:00
Eric Huss
bead46769c Stabilize doctest-xcompile
This stabilizes the doctest-xcompile feature by unconditionally enabling
it.
2025-05-14 08:52:27 -07:00
Weihang Lo
090dcfe9af
fix(publish): better message when nothing to publish
This doesn't need to be an hard error because missing
publish for the entire worspace should be a fairly visible.
However, this is open for future to configure via Cargo lint system.
2025-05-14 01:22:30 -04:00
Weihang Lo
4f7494c4ec
feat(publish): workspace publish skips publish=false
This changes how cargo-publish works with the unstable
`-Zpackage-workspace` feature.

Before this, when publishing the entire workspace,
like `cargo publish --workspace`,
if there is a package with `package.pulibsh=false,
it'll fail the entire publish process.

After this, when `--workspace` is passed,
or when publishing the virtual workspace,
the intent is more like “publish all publishable in this workspace”,
so skip `publish=false` packages and proceed to publish others.

The new overall behavior looks like this:

- `cargo publish` (inside a `package.publish = false` package): error
- `cargo publish -p publishable -p unpublishable`: error
- `cargo publish --workspace`: skips `package.publish = false

See https://github.com/rust-lang/cargo/issues/15006#issuecomment-2847660911
2025-05-14 01:22:29 -04:00
Weihang Lo
2421496c92
test(publish): prepare tests for skipping unpublishable
For `-Zpackage-workspace`.
2025-05-14 01:08:22 -04:00
Eric Huss
a154422cec
feat(network): use Retry-After header for HTTP 429 responses (#15463)
### What does this PR try to resolve?

Cargo registries that return HTTP 429 when the service is overloaded
expect the client to retry the request automatically after a delay.
Cargo currently does not retry for HTTP 429.

### What changed?
* Adds HTTP 429 (too many requests) as a spurious HTTP error to enable
retries.
* Parse the
[Retry-After](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Retry-After)
HTTP header to determine how long to wait before a retry.

In this implementation, the maximum delay is limited to Cargo's existing
limit of 10 seconds. We could consider increasing that limit for this
case, since the server is explicitly requesting the delay.
2025-05-07 21:22:52 +00:00
Arlo Siemsen
b72d6476ae feat(network): use Retry-After header for HTTP 429 responses 2025-05-07 15:44:35 -05:00
Ed Page
cf7b053c0f
Make cargo script ignore workspaces (#15496)
### What does this PR try to resolve?

Cargo script considers itself part of the workspace if the script is
located in a sub-directory of a workspace (presumably since
https://github.com/rust-lang/cargo/pull/15168). This becomes an issue
when using a custom registry that is defined in the `.cargo/config.toml`
within the workspace. Cargo script does not take that file into account
and fails with ``registry index was not found in any configuration:
`test-reg` ``.

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

This PR adds a regression test and makes cargo script ignore the
surrounding workspace.
The test ~~will fail without the fix in the second commit and~~ can be
used to reproduce the issue.

### Additional information

The issue started occurring with `nightly-2025-02-16`.
Related to https://github.com/rust-lang/cargo/issues/12207.

<!--
Thanks for submitting a pull request 🎉! Here are some tips for you:

* If this is your first contribution, read "Cargo Contribution Guide"
first:
  https://doc.crates.io/contrib/
* Run `cargo fmt --all` to format your code changes.
* Small commits and pull requests are always preferable and easy to
review.
* If your idea is large and needs feedback from the community, read how:
  https://doc.crates.io/contrib/process/#working-on-large-features
* Cargo takes care of compatibility. Read our design principles:
  https://doc.crates.io/contrib/design.html
* When changing help text of cargo commands, follow the steps to
generate docs:

https://github.com/rust-lang/cargo/tree/master/src/doc#building-the-man-pages
* If your PR is not finished, set it as "draft" PR or add "WIP" in its
title.
* It's ok to use the CI resources to test your PR, but please don't
abuse them.

Explain the motivation behind this change.
A clear overview along with an in-depth explanation are helpful.

You can use `Fixes #<issue number>` to associate this PR to an existing
issue.

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

Demonstrate how you test this change and guide reviewers through your
PR.
With a smooth review process, a pull request usually gets reviewed
quicker.

If you don't know how to write and run your tests, please read the
guide:
https://doc.crates.io/contrib/tests

### Additional information

Other information you want to mention in this PR, such as prior arts,
future extensions, an unresolved problem, or a TODO list.
-->
2025-05-07 14:23:29 +00:00
arctic-alpaca
2b247ffd4e
make cargo script ignore surrounding workspace 2025-05-07 07:48:08 +02:00
arctic-alpaca
03a2a29aed
add test for cargo script workspace handling 2025-05-07 07:43:44 +02:00
Ed Page
f83e11acfe fix(rustc): Don't panic on unknown bins
This takes the most surgical, direct route to addressing the problem.
Alternatively, we could look into why `cargo rustc` and `cargo check`
are different.

Fixes #15493
2025-05-06 11:13:30 -05:00
Ed Page
02ec8d48e5 test(rustc): Show the bug 2025-05-06 11:05:10 -05:00
Weihang Lo
33d7b0aa92
test: Remove unused nightly requirements (#15498)
### What does this PR try to resolve?

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

### Additional information
2025-05-06 18:26:39 +00:00
Ed Page
b81c676ebc test: Remove unused nightly requirements 2025-05-06 12:52:20 -05:00