1125 Commits

Author SHA1 Message Date
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
renovate[bot]
bf7ac6563f
chore(deps): update alpine docker tag to v3.22 2025-06-01 00:50:52 +00:00
Ed Page
92cb7b9a60 chore: Upgrade schemars
0.9.0 may look like a downgrade but the maintainer has decided to go
  back to `0.x` versions rather than continuing to use pre-release
versions
2025-05-27 12:34:14 -05:00
AudaciousAxiom
8362109b8e chore(toml): disable toml's default features, unless necessary
This reduces the build time of `cargo-util-schemas`.
2025-05-25 13:31:18 +02:00
Ed Page
31433a3094 chore: Bump package versions 2025-05-20 16:08:34 -05:00
renovate[bot]
8b5fd61ec8
chore(deps): update msrv (1 version) to v1.87 2025-05-15 23:35:57 +00:00
kyu08
ded3f36068 docs: update version notice for deprecation removal 2025-05-09 22:10:46 +09:00
Arlo Siemsen
b72d6476ae feat(network): use Retry-After header for HTTP 429 responses 2025-05-07 15:44:35 -05:00
Ed Page
69eeb6ad94
Implement RFC3695: Allow boolean literals as cfg predicates (#14649)
### What does this PR try to resolve?

This PR implements https://github.com/rust-lang/rfcs/pull/3695: allow
boolean literals as cfg predicates, i.e. `cfg(true)` and `cfg(false)`.

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

The PR should be reviewed commit by commit and tested by looking at the
tests and using `[target.'cfg(<true/false>)']` in
`Cargo.toml`/`.cargo/config.toml`.

### Additional information

I had to bump `cargo-platform` to `0.3.0` has we are changing `CfgExpr`
enum in a semver incompatible change.

We currently have (thks to
https://github.com/rust-lang/cargo/pull/14671) a forward compatibility
warning against `cfg(true/false)` as identifiers instead of keywords.

~~I choose a use a `Cargo.toml` feature (for the manifest) as well as a
unstable CLI flag for the `.cargo/config.toml` part.~~

~~Given the very small (two occurrences on Github Search) for
[`cfg(true)`](https://github.com/search?q=lang%3Atoml+%2F%28%3F-i%29%5C%5Btarget%5C.%5B%27%22%5Dcfg.*true%2F&type=code)
and
[`cfg(false)`](https://github.com/search?q=lang%3Atoml+%2F%28%3F-i%29%5C%5Btarget%5C.%5B%27%22%5Dcfg.*false%2F&type=code),
I choose to gate the feature under a error and not a warning.~~
2025-04-22 17:54:52 +00:00
Urgau
9563738dff Add support for boolean literals in target cfgs 2025-04-22 19:23:03 +02:00
Urgau
4fc4e12189 Bump cargo-platform to 0.3.0 in preparation for cfg(<true/false>) 2025-04-22 19:18:12 +02:00
Weihang Lo
db99ddc418
test(rustfix): Use snapbox for snapshot testing (#15429)
### What does this PR try to resolve?

- separates each test into different test cases
- `snapbox` is used to test the snapshots
  - difference in `.json` file alone should never cause a test to fail
- `.json` files updated only if expected fix != actual fix &&
`SNAPSHOTS=overwrite`
- when `.json` files are updated, the json is pretty printed
- replaced environment variables `RUSTFIX_TEST_*` for overwriting test
snapshots with `SNAPSHOTS=overwrite`
-  The `RUSTFIX_TEST_RECORD_FIXED_RUST` feature is removed (generate a
`*.fixed.rs` on demand`). We can add it back whenever needed.

Fixes #13891

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

Run tests with:
```sh
cargo test -p rustfix
```
All the test should run as different test cases
nightly tests run only when using nightly version of rustc is used
2025-04-14 17:21:24 +00:00
Pyrode
2c4f3e4030 test(rustfix): change test multiple-solutions from nightly to stable 2025-04-14 21:27:05 +05:30
Pyrode
a2e42dc67c test(rustfix): Using snapbox for snapshot testing
`.json` files will have pretty printed json when updated
2025-04-14 00:32:03 +05:30
Pyrode
ba411d6a65 test(rustfix): Seperated tests to different testcases 2025-04-14 00:24:24 +05:30
Ed Page
2ce0898758 chore: Bump build-rs version 2025-04-11 15:04:23 -05:00
Ed Page
bb349213ce fix(build): Correct name of CARGO_CFG_FEATURE 2025-04-11 13:37:49 -05:00
Scott Schafer
df915190e3
chore: Bump cargo-util-schemas to 0.8.2 2025-04-04 22:54:51 -06:00
Scott Schafer
8855150d30
chore: Bump cargo-util-schemas to 0.8.1 2025-04-04 22:45:21 -06:00
Scott Schafer
66991b5a33
chore: Bump cargo-util-schemas to 0.8.0 2025-04-04 22:44:24 -06:00
Weihang Lo
b955cd1822
chore(ci): restore cargo-util semver check 2025-04-04 08:05:43 -07:00
Eric Huss
be781458a9 Bump versions due to MSRV update 2025-04-03 07:11:48 -07:00
renovate[bot]
fc88578277
chore(deps): update msrv (1 version) to v1.86 2025-04-03 12:07:38 +00:00
Weihang Lo
2080ac30df
chore(ci): add aarch64 linux runner
Linux arm64 hosted runners is in public preview.
Enable and see if is is something we can have now.

setting `target.linker` is required for cross-compilation
on ARM64, so disable cross compilation tests for it.

https://github.blog/changelog/2025-01-16-linux-arm64-hosted-runners-now-available-for-free-in-public-repositories-public-preview/
2025-04-01 22:07:36 -07:00
Weihang Lo
4e8014f4be
feat(schemas): add PackageList message schema
This is is for `cargo package --list` in JSON format
2025-03-25 23:02:37 -04:00
pudongair
6c7c360dec chore: fix some typos
Signed-off-by: pudongair <744355276@qq.com>
2025-03-19 21:05:18 +08:00
bjorn3
c340cd902d Bump home version to 0.5.12 2025-03-13 21:37:39 +01:00
bjorn3
9e74cce829 Redox OS is part of the unix family 2025-03-13 21:19:46 +01:00
Eric Huss
fae82d8efa Update to pulldown-cmark 0.13 API changes 2025-03-01 11:13:42 -08:00
Arlo Siemsen
5f833db69b feat: Add SBOM pre-cursor files
Adds a new option `build.sbom` that adds generation of a JSON file
containing dependency information alongside compiled artifacts.
2025-02-26 14:57:14 -06:00
Eric Huss
10175b1760
chore: semver-check build-rs against beta channel (#15223)
### What does this PR try to resolve?

This should have been restored when 1.84 was out,
but nobody remembered.
2025-02-23 14:38:42 +00:00
Weihang Lo
e820df0ca8
chore: sever-check build-rs against beta channel 2025-02-22 10:36:48 -05:00
Weihang Lo
80331b1ea6
chore: dont check cargo-util semver until 1.86 is released
This fixes the current confusing failures in our CI pipeline:

* https://github.com/rust-lang/cargo/actions/runs/13465687015/job/37630870984
* https://github.com/rust-lang/cargo/actions/runs/13469881475/job/37642079118

CI job failed because of this major SemVer breakage:

```diff
-pub fn strip_prefix_canonical<P: AsRef<Path>>(
-    path: P,
-    base: P,
+pub fn strip_prefix_canonical(
+    path: impl AsRef<Path>,
+    base: impl AsRef<Path>,
 ) -> Result<PathBuf, std::path::StripPrefixError> {
```

While cargo-util does have that change violating SemVer,
it is unlikely people use it with turbo-fish syntax.
And cargo-util is essentially for internal use.

See:

* https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/check-version-bump.20failure
* https://forge.rust-lang.org/policies/crate-ownership.html#internal-use
2025-02-22 10:32:32 -05:00
Ed Page
f5ec77b18e docs(utils): Clarify expected state of name for make_dep_path
For index entries, the caller must lowercase the name.
2025-02-21 08:25:23 -06:00
Ed Page
05228f76f4 chore(ci): Check against beta first
Most breaking changes should be against beta and it would be good to
have the context of whether we deviated from beta before checking
against stable.
2025-02-21 09:50:36 -06:00
Ed Page
f035814fe2 chore(ci): Visually group output in Github 2025-02-21 09:13:36 -06:00
Ed Page
88f858a5b5 refactor(bump): Visual group related operations 2025-02-21 09:11:33 -06:00
Ed Page
b4dee5dcf9 chore: Bump versions 2025-02-20 15:47:07 -06:00
renovate[bot]
c30d4f9293
chore(deps): update msrv (1 version) to v1.85 2025-02-20 19:37:56 +00:00
Arlo Siemsen
44de80f89c fix: build warning in windows_reserved_names_are_allowed 2025-02-19 10:59:50 -06:00
Samuel Moelius
65521c3ba0
Typo: "explicitally" -> "explicitly" 2025-02-18 19:06:15 -05:00