20247 Commits

Author SHA1 Message Date
Eric Huss
79906dc177 Update dependencies 2025-06-05 06:31:23 -07:00
Eric Huss
77fa64b524 Pin handlebars to 6.3.1
This is due to an issue in 6.3.2 that breaks the way our includes are
being used. I'm not sure how to fix it at this point.
2025-06-05 06:29:32 -07:00
Eric Huss
ec0e24627d
fix(publish): Don't tell people to ctrl-c without knowing consequences (#15632)
### What does this PR try to resolve?

Telling people they are free to hit ctrl-c while waiting for packages
could mean some packages may not be published and the user wouldn't know
until they get a complaint about a missing package.

Instead, if there are remaining packages, we'll tell the user that.

Fixes #15005

### How to test and review this PR?
2025-06-05 13:26:56 +00:00
lemorage
304a7a0748 fix(workspace): reload current manifest only 2025-06-05 13:25:04 +02:00
lemorage
f22b84f8d4 test(workspace): clippy fix work on all crate members 2025-06-05 04:30:50 +02:00
Ed Page
2e1f971c43 fix(publish): Don't tell people to ctrl-c without knowing consequences
Fixes #15005
2025-06-04 20:00:19 -05:00
Ed Page
f0161607fb refactor(publish): Remove manual package list 2025-06-04 19:54:35 -05:00
Ed Page
355bc56244 fix(publish): Remove quotes around packages
These aren't there elsewhere
2025-06-04 19:54:27 -05:00
Ed Page
ba789f04c7 fix(publish): Pluralize the wait message 2025-06-04 19:53:42 -05:00
Ed Page
8c401a2674 refactor(publish): Move reporting up a level
This gives us access to more context and makes it easier to see how
other timeout reporting happens.
2025-06-04 19:52:52 -05:00
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
Weihang Lo
a32f073598
fix(package): Skip registry check if its not needed (#15629)
### What does this PR try to resolve?

As of #13947, `-Zpackage-workspace` made `cargo package` require extra
arguments when it didn't need it before. When a packaging operation will
resolve dependencies, we need to know what registry packages would be
published to in order to correctly generate the overlay to generate the
right lockfile.

We skipped this if there were no dependencies, so no overlay was going
to be used, to reduce the impact of this.

This change goes a step further and only runs the check if the resolver
will run. This should mean that `-Zpackage-workspace` should now only
error when `cargo package` would have failed before.

### How to test and review this PR?

To verify this, the existing failure tests were forked, removing
`-Zpackage-workspace`, and then `--exclude-lockfile`, `--no-verify`, and
`--exclude-lockfile --no-verify` variants were added to characterize
when the check is behavior-neutral vs not needed and that the behavior
is now the same.
2025-06-04 21:21:50 +00:00
Eric Huss
21601a2464
Add --offline for comp (#15623)
_Thanks for the pull request 🎉!_
_Please read the contribution guide: <https://doc.crates.io/contrib/>._

### What does this PR try to resolve?

Bash and Zsh `cargo add` completion option `--offline`

_Explain the motivation behind this change._
_A clear overview along with an in-depth explanation are helpful._

### How to 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._
2025-06-04 20:56:00 +00: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
778f3513e3 refactor(package): Switch to positive logic 2025-06-04 13:18:00 -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
f1bf94d3b2
cargo-credential-libsecret: load libsecret only once (#15295)
Previously, libsecret was repeatedly loaded and unloaded—at least twice
during cargo login (once for action get and once for action login). This
caused issues where calls could hang indefinitely due to glib failing to
clean up properly (some threads still running after unloading) and
generating numerous error messages:
```
cargo login --registry ownreg
    Updating `ownreg` index
please paste the token for ownreg below

(process:100727): GLib-GObject-CRITICAL **: 08:59:54.568: cannot register existing type 'SecretService'

(process:100727): GLib-GObject-CRITICAL **: 08:59:54.568: cannot add private field to invalid (non-instantiatable) type '<invalid>'

(process:100727): GLib-GObject-CRITICAL **: 08:59:54.568: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:100727): GLib-GObject-CRITICAL **: 08:59:54.568: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:100727): GLib-GObject-CRITICAL **: 08:59:54.568: cannot register existing type 'SecretBackend'

(process:100727): GLib-GObject-CRITICAL **: 08:59:54.568: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed

(process:100727): GLib-GObject-CRITICAL **: 08:59:54.568: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed

(process:100727): GLib-CRITICAL **: 08:59:54.568: g_once_init_leave_pointer: assertion 'result != 0' failed

(process:100727): GLib-GObject-CRITICAL **: 08:59:54.568: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
```

Now, libsecret is stored in a OnceLock, ensuring it is only loaded once,
preventing unnecessary unload/reload cycles.

Fixes #15603
2025-06-04 16:00:42 +00:00
Benjamin Bigler
b881a3285b fix: add OnceLock for LibSecretCredential
Previously, LibSecretCredential was created multiple times and with it
libsecret was loaded and unloaded multiple times, leading to issues
where calls could run indefinitely due to glib not properly cleaning up.
Now, LibSecretCredential is stored in a OnceLock, ensuring it is only
created once, preventing unnecessary unload/reload cycles of libsecret.
2025-06-04 17:24:23 +02:00
Benjamin Bigler
22940c701e refactor: make LibSecretCredential own libsecret library 2025-06-04 17:24:20 +02:00
Benjamin Bigler
e208691f95 chore: bump cargo-credential-libsecret 2025-06-04 17:24:15 +02:00
Scott Schafer
41cf907182
test(publish): Improvements in prep for -Zpackage-workspace stabilization (#15628)
### What does this PR try to resolve?

Attempting to reduce the size of the stabilization PR so the
stabilization changes are more obvious, without pulling something out
that is meaningless.

### How to test and review this PR?
2025-06-04 14:35:20 +00: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
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
Weihang Lo
762fbf9bcb
docs: clarify --all-features not available for all commmands (#15572)
### What does this PR try to resolve?
Fixes #15571

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

N/A

### Additional information

N/A
2025-06-03 17:31:39 +00:00
A4-Tacks
12d6725a6e
Add --offline to zsh common comp 2025-06-04 01:26:08 +08:00
A4-Tacks
098a148fab
Use $opt_lock for bashcomp 2025-06-04 00:42:28 +08:00
jbteves-sandia
b081f2cf0d
Update features.md 2025-06-03 10:52:29 -04:00
Weihang Lo
f1193861a3
Remove double reference in Shell::print_json (#15460)
`obj` is already `&T`.

<!--
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.

### What does this PR try to resolve?

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-06-03 13:42:01 +00:00
A4-Tacks
b066b7848a
Add --offline for comp 2025-06-03 14:20:52 +08:00
Ed Page
f6bebc3abb
fix(trim-paths): remap all paths to build.build-dir (#15614)
### What does this PR try to resolve?

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).

### How to test and review this PR?

Should be quite straightforward.

The open question is what we want to remap _to_, to help debugger to
find the source files.
cc #12137 and #13171
2025-06-02 19:04:43 +00: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
120ad80c57
fix(fingerprint): explicit reason rather than "stale; unknown reason" (#15617)
### What does this PR try to resolve?

This was discovered during playing with rmeta reuse between cargo-check
and cargo-build.

An rmeta mtime failure is basically the same as "failed to read
metadata".

While we don't report in tracing log, that should be fine because dirty
reason will be reported in the other place.

### How to test and review this PR?

Should have no real user-facing behavior change.
2025-06-02 16:51:33 +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
cf87e117ae
fix(test-support): check executability instead of running --version
Not every executable has a `--version` flag.
Let's check the exectuability instead.

Note that on Windows we check if it is file only.
There is a `is_executable` crate on crates.io,
though that still depend on winapi so don't bother using it.
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
21a67e29e6
chore(deps): update alpine docker tag to v3.22 (#15616)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| alpine | final | minor | `3.21` -> `3.22` |

---

### Configuration

📅 **Schedule**: Branch creation - "before 5am on the first day of the
month" (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:eyJjcmVhdGVkSW5WZXIiOiI0MC4zMy42IiwidXBkYXRlZEluVmVyIjoiNDAuMzMuNiIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119-->
2025-06-01 14:04:39 +00:00
Weihang Lo
c6f5f3fcae
fix(fingerprint): explicit reason than "stale; unknown reason"
This was discovered during playing with rmeta reuse
between cargo-check and cargo-build
2025-05-31 21:17:59 -04:00