7252 Commits

Author SHA1 Message Date
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
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