7161 Commits

Author SHA1 Message Date
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
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
Eric Huss
5c19611910 Update tests now that 1.88 is stable 2025-06-27 08:19:34 -07:00
Ed Page
4ac865d3d7
Rework cargo-test-support & testsuite to use CARGO_BIN_EXE_* for Cargo (#15692)
### What does this PR try to resolve?

This PR reworks `cargo-test-support` and `testsuite` to use Snapbox's
[`cargo_bin!()`](https://docs.rs/snapbox/latest/snapbox/cmd/macro.cargo_bin.html)
instead of
[`cargo_bin()`](https://docs.rs/snapbox/latest/snapbox/cmd/fn.cargo_bin.html)
which makes assumptions about the structure of Cargo's build directory.
`cargo_bin!()` uses `CARGO_BIN_EXE_*` for locating the `cargo` binary
which should be more resilient to directory/layout changes.

Linking a relevant Zulip discussion
[here](https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/cargo_bin_exe.20and.20tests/with/513638220)[#t-cargo
> cargo_bin_exe and
tests](https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/cargo_bin_exe.20and.20tests/with/513638220)

As shown in that link, we could make these variables available at
runtime and not need to do this. However, `cargo-test-support`, as an
API, is a bit weird in that it is baking in support for one specific
binary. This can be confusing for callers and makes it more annoying for
callers provide their own `fn cargo`, e.g. see crate-ci/cargo-fixit#7

### Implementation Notes

`cargo_bin!()` only works when being called from the `testsuite` as it's
only set when executing integration tests and `cargo-test-support` is a
regular crate.
To make this change, I introduced an extension trait `CargoProjectExt`
in `testsuite` for running `.cargo()` and implemented it on `Project`.

In `cargo-test-support` other functionality relies on `.cargo()` so
these also needed to be moved to `testsuite`
*
[`src/tools.rs`](https://github.com/rust-lang/cargo/blob/master/crates/cargo-test-support/src/tools.rs)
* Parts
[`src/cross_compile`](https://github.com/rust-lang/cargo/blob/master/crates/cargo-test-support/src/cross_compile.rs)
* I had to split this up unfortunately, as `disabled()` requires running
Cargo to check if we should disable cross compile tests.
* Other fns in `cross_compile` are used in `cargo-test-support` so
moving everything to `testsuite` would have ended up requiring moving
many things to test suite.

### How to test and review this PR?

I'd definitely recommend reviewing commit by commit.
There are a lot of diffs due to the nature of reorganizing things.
I did my best to split things things into smaller PRs but they still
contain a lot of `use` statement diffs.

r? @epage
2025-06-26 15:21:51 +00:00
motorailgun
8f4ae79cb5 fix: Expand error messages around path dependency on cargo package and cargo publish 2025-06-26 02:53:54 +00:00
Ross Sullivan
30b6707135
chore: Moved remaining cargo_exe logic to testsuite 2025-06-25 23:18:08 +09:00
Ross Sullivan
15f755cefd
chore: Created CargoProjectExt extention trait 2025-06-25 23:18:00 +09:00
Ross Sullivan
92d9a94d02
chore: Migrated testsuite to testsuite::prelude 2025-06-25 22:37:24 +09:00
Ross Sullivan
66fc1055a7
chore: Created testsuite prelude 2025-06-25 22:29:12 +09:00
Ross Sullivan
47312c446d
chore: Moved tools and some cross compiling logic into testsuite 2025-06-24 23:51:39 +09:00
Naman Garg
5c7f68fe5d
Add multi-build script support to cargo vendor 2025-06-23 19:14:41 +05:30
Naman Garg
21c2f1615d
Add multi-build script support to cargo publish 2025-06-23 19:14:40 +05:30
Naman Garg
68429eb381
Attach all build scripts to the target 2025-06-23 19:14:38 +05:30
Naman Garg
a9d5cb8abe
Add MultipleScript (error on stable, error about not implemented on nightly) 2025-06-23 19:14:37 +05:30
Naman Garg
db8dbaf3ed
Add initial tests for multiple build scripts (not implemented yet) 2025-06-23 19:14:36 +05:30
Josh Stone
d97bf418d9 test(msrv): use a far future "newer" version
Two tests were using `.rust_version("1.90.0")` for a "newer" Rust, but
this failed in rust-lang/rust#142792 for the start of the *real* 1.90.0.
Let's bump that to 1.999.0 so we won't have to deal with it for a while.
2025-06-22 12:05:40 -07:00
Josh Triplett
dd183e0338 Test hint-mostly-unused with check rather than build 2025-06-20 15:16:03 -07:00
Josh Triplett
36480ce012 Plumb rustc -Zhint-mostly-unused flag through as a profile option
The rustc `-Zhint-mostly-unused` flag tells rustc that most of a crate
will go unused. This is useful for speeding up compilation of large
dependencies from which you only use a few items. Plumb that option
through as a profile option, to allow specifying it for specific
dependencies:

```toml
[profile.dev.package.huge-mostly-unused-dependency]
hint-mostly-unused = true
```

To enable this feature, pass `-Zprofile-hint-mostly-unused`. However,
since this option is a hint, using it without passing
`-Zprofile-hint-mostly-unused` will only warn and ignore the profile
option. Versions of Cargo prior to the introduction of this feature will
give an "unused manifest key" warning, but will otherwise function
without erroring. This allows using the hint in a crate's `Cargo.toml`
without mandating the use of a newer Cargo to build it.

Add a test verifying that the profile option gets ignored with a warning
without passing `-Zprofile-hint-mostly-unused`, and another test
verifying that it gets handled when passing
`-Zprofile-hint-mostly-unused`.
2025-06-20 15:16:03 -07:00
Josh Triplett
0419be8eae Disable cdb test, which seems to be broken 2025-06-20 02:21:46 -07:00
Josh Triplett
4cfa4b0c60 Disable lldb test, which seems to be broken due to issues with lldb 2025-06-20 01:43:22 -07:00
Shoyu Vanilla
072b345bbf feat(compile-time-deps): Add cli flag --compile-time-deps and adjust docs 2025-06-19 09:09:32 +09:00
Shoyu Vanilla
d253d12122 test(compile-time-deps): Add tests for --compile-time-deps 2025-06-19 09:09:32 +09:00
Shoyu Vanilla
da332544bc fix: Failing tests on rustc nightly 2025-06-19 01:05:01 +09:00
0xPoe
5f900981de refactor: replace InternedString with into() conversions across the codebase
Signed-off-by: 0xPoe <techregister@pm.me>
2025-06-14 23:43:16 +02:00
Scott Schafer
ccbe572a74
fix: Make UI tests handle hyperlinks consistently 2025-06-05 21:58:25 -06:00
Ed Page
60400187f4
Update "time out" to "timeout" (#15637)
This read a little awkwardly to me. "time out" is a verb, but normally a
noun follows "due to".
2025-06-05 15:09:32 +00:00
Eric Huss
9e307b180c Update "time out" to "timeout"
This read a little awkwardly to me. "time out" is a verb, but normally a
noun follows "due to".
2025-06-05 07:24:41 -07:00
Weihang Lo
2094c9f46b
fix(workspace): reload current manifest path member only (#15633)
### What does this PR try to resolve?

As of #15625, the manifest path argument in `cargo clippy
--manifest-path foo/Cargo.toml --fix` will be ignored. All the workspace
members will be built. The cause is due to the `reload` usage in
`cargo::ops::fix`. We reload the `root_manifest` in the function, which
contains all workspace members.

Will close #15625.

### How to test and review this PR?

The first commit in the PR demonstrates the current problem, and the
second commit corrects it. Use `cargo test --test testsuite
workspaces::fix_only_check_manifest_path_member` to see the test
results.
2025-06-05 14:14:35 +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
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