1115 Commits

Author SHA1 Message Date
Vito Secona
949e863cb9 refactor: move lockfile schemas to cargo-util-schemas 2025-09-19 01:15:32 +07:00
Vito Secona
535f7730fa refactor: define lockfile errors in cargo-util-schemas
Some of the fields are made public to make the moving phase easier. They
will be reverted back to private when its done moving over.
2025-09-19 00:49:25 +07:00
Scott Schafer
022dc5b381
chore: Address most typos 2025-09-02 18:15:50 -06:00
Weihang Lo
56f44bb212
test: avoid hardcoded target spec json
Read a real target spec JSON so we no longer need to hardcode
a target spec JSON here.
Cargo itself should not care about the spec schema.

Let's stop bothering compiler contributors.
2025-08-23 22:26:08 -04:00
Samuel Onoja
5dd597b621
impl workspace hint for boolean dependencies
hint for only bad dependency true literal and rename unit test to match
2025-08-19 18:15:32 +01:00
Karol Zwolak
cec8eb1d16 bump rustfix version to 0.9.3 2025-08-17 18:50:55 +02:00
Karol Zwolak
fb046a1354 update tests to match lint message changes from rust-lang/rust#140794 2025-08-17 18:50:55 +02:00
Eric Huss
e647065d5d
chore: remove x86_64-apple-darwin from CI and tests (#15831)
### What does this PR try to resolve?

RFC 3841 has merged, and x86_64-apple-darwin will be demoted to tier-2
in 1.90.0. In Cargo we usually run test against tier-1 platforms, so
x86_64-apple-darwin should be removed.
Also, that target platform is often the slowest one in CI, we are happy
to remove it to save us a couple of minutes.

https://rust-lang.github.io/rfcs/3841-demote-x86_64-apple-darwin.html

### How to test and review this PR?

Run `cargo test` locally with cross-compile tests enabled, and no
regression.
2025-08-12 20:48:04 +00:00
Weihang Lo
9614bc251b
chore: remove x86_64-apple-darwin from CI and tests
RFC 3841 has merged, and x86_64-apple-darwin will be demoted to tier-2
in 1.90.0. In Cargo we usually run test against tier-1 platforms, so
x86_64-apple-darwin should be removed.
Also, that target platform is often the slowest one in CI,
we are happy to remove it to save us a couple of minutes.

https://rust-lang.github.io/rfcs/3841-demote-x86_64-apple-darwin.html
2025-08-12 16:02:16 -04:00
2ndDerivative
6d3ff14969
add is_inherited method to InheritableField 2025-08-12 17:04:54 +02:00
2ndDerivative
e58ab62a09
add is_inherited method to InheritableDependency 2025-08-12 16:54:49 +02:00
Ed Page
178a07231e chore: Bump versions 2025-08-07 10:15:50 -05:00
renovate[bot]
f0379a2a8c chore(deps): update msrv (1 version) to v1.89 2025-08-07 13:00:25 +00:00
Ojus Chugh
c0c256ba17 docs(build-rs): Fix broken intra-doc links
These were caught with the latest nightly

This was pulled from #15800
2025-08-05 12:03:46 -05:00
Ed Page
37eeab7c16
feat(schema): Expose IndexPackage, the description of a package within a Registry Index (#15770)
### What does this PR try to resolve?

ref https://github.com/rust-lang/cargo/issues/14834

In this pull request, I moved `IndexPackage` to `cargo-util-schemas` to
enable third-party applications and `cargo-dev-registry` to utilize this
common struct.

For instance, crates.io has its own `IndexPackage` located at
005667f041/crates/crates_io_index/data.rs (L5).

By moving it to `cargo-util-schemas`, we allow different applications to
use this struct more easily.

### How to test and review this PR?

It shouldn't break any tests; it's just a refactoring.
2025-07-28 19:35:47 +00:00
0xPoe
8811325b5a feat: add JSON schema support for IndexPackage and RegistryDependency structs
Signed-off-by: 0xPoe <techregister@pm.me>
2025-07-27 15:02:34 +02:00
0xPoe
a7fcef21fe refactor: move IndexPackage and RegistryDependency to cargo-util-schemas for better modularity
Signed-off-by: 0xPoe <techregister@pm.me>
2025-07-27 15:02:27 +02:00
David Tolnay
1441ea4f4a
Perform cargo-semver-checks separately for cargo crate 2025-07-25 07:49:17 -07:00
Josh Triplett
94c27dfaea cargo-util-schemas: Bump breaking version for schema change 2025-07-12 14:55:10 -07:00
Josh Triplett
fe86023863 Parse hints permissively to allow for future expansion
Make it only a warning, not an error, to have a hint value of the wrong
type.
2025-07-11 16:54:36 -07:00
Josh Triplett
1921d097ca Add [hints] table in Cargo.toml, and a hints.mostly-unused hint
The `[hints]` table in a `Cargo.toml` manifest provides optional
information that Cargo can use for building the package, and will use
even when using the package as a dependency. All hints can be safely
ignored, and Cargo only warns about unknown hints, but does not error.
This allows packages to use hints without depending on new Cargo.

Add a `mostly-unused` hint, which allows a package to hint that most
users of the package will not use most of its items. This is useful for
improving the build performance of crates with large dependencies.

Crates can override this hint using `hint-mostly-unused = false` in
their profile for a dependency.
2025-07-11 16:54:36 -07:00
Ed Page
539a48452a perf: Update toml 2025-07-08 11:55:41 -05:00
Eric Huss
e24a9865ac Apply deprecated_safe_2024 2025-07-05 20:17:36 -07:00
Eric Huss
639143579a Bump crate versions 2025-07-05 19:57:28 -07:00
Eric Huss
1ce8023626 Rustfmt 2024 2025-07-05 19:50:36 -07:00
Eric Huss
a0d1859575 Apply keyword_idents_2024 2025-07-05 19:29:09 -07:00
Eric Huss
24813db9da Apply missing_unsafe_on_extern 2025-07-05 19:28:38 -07:00
Eric Huss
1213fc652b Apply rust_2024_incompatible_pat 2025-07-05 19:27:01 -07:00
Ed Page
d8975d2901 chore: Update incompatible versions 2025-07-01 13:51:18 -05:00
Ed Page
e8a9510f11 chore(rustfix): Bump to 0.9.2 2025-06-30 13:37:27 -05:00
Ed Page
dca5d6409c test(rustfix): Update for nightly
Inspired by #15713
2025-06-30 13:17:09 -05:00
Ed Page
0b611990f4 style: Use inlined format args 2025-06-26 16:40:32 -05:00
Ed Page
e5987ea9b6 chore: Bump versions 2025-06-26 16:38:16 -05:00
renovate[bot]
e6740738a8
chore(deps): update msrv (1 version) to v1.88 2025-06-26 19:55:27 +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
47312c446d
chore: Moved tools and some cross compiling logic into testsuite 2025-06-24 23:51:39 +09:00
Naman Garg
a9d5cb8abe
Add MultipleScript (error on stable, error about not implemented on nightly) 2025-06-23 19:14:37 +05:30
Naman Garg
126b3a18c1
Refactor normalized_build to accept slice instead of string 2025-06-23 19:14:35 +05:30
Naman Garg
92b00aefc3
Fork StringOrBool into new TomlPackageBuild type and update manifest.schema.json 2025-06-23 19:14:33 +05:30
Naman Garg
93fd488f94
Rename readme variable to build 2025-06-23 19:14:30 +05:30
Eric Huss
0c59ee9009 Bump cargo-util-schemas version
https://github.com/rust-lang/cargo/pull/15643 introduced a semver
breaking change by adding a new pub field to `TomlProfile`.
2025-06-22 15:54:29 -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
262d4dd5f2 Use Not::not rather than a custom is_false function
The `is_false` function already exists in the standard library, as
`Not::not`; use that in `skip_serializing_if` rather than defining an
`is_false` function.
2025-06-08 19:15:27 -07:00
Scott Schafer
ccbe572a74
fix: Make UI tests handle hyperlinks consistently 2025-06-05 21:58:25 -06: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
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
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