Hi Everyone!
This is PR for the manifest parsing of the first milestone of [GSoC
Project : Build Script
Delegation](https://summerofcode.withgoogle.com/programs/2025/projects/nUt4PdAA)
### What does this PR try to resolve?
Currently, just a single build script is allowed for each package. This
PR will allow users to create and use multiple build scripts, and is
backward compatible with single script as well as boolean values.
**Motivation :** This will help users to maintain separate smaller and
cleaner build scripts instead of one large build script. This is also
necessary for build script delegation.
**Open questions:**
- What should the build script target names be?
- Currently they use the file stem of the build script which could run
into conflicts
**Known Issues:**
- This is just parsing support, and currently, only the first build
script of the array is actually executed.
### How to test and review this PR?
There is a feature gate `multiple-build-scripts` that can be passed via
`cargo-features` in `Cargo.toml`. So, you have to add
```toml
cargo-features = ["multiple-build-scripts"]
```
Preferably on the top of the `Cargo.toml` and use nightly toolchain to
use the feature
**This PR is ready to be reviewed and merged**
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.
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.
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`.
### How to test and review this PR?
The tests in the testsuite demonstrate both that the option works as
expected and that it gets ignored with a warning if not passing
`-Zprofile-hint-mostly-unused`.
This will remain a draft until
https://github.com/rust-lang/rust/pull/135656 gets merged in rustc; once
that happens, the "nightly" jobs will pass in CI.
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`.
fix#15656
### What does this PR try to resolve?
This PR implements custom TAB completer for cargo remove <package_name>.
### How to test and review this PR?
This patch works like this:
```console
$ cat Cargo.toml
[package]
name = "sandbox"
version = "0.1.0"
edition = "2024"
[dependencies]
rand = "0.9.1"
serde_json = "1"
$ ~/cargo/target/debug/cargo remove
completing values
--build -- Remove from build-dependencies
--color -- Coloring
--config -- Override a configuration value
--dev -- Remove from dev-dependencies
--dry-run -- Don't actually write the manifest
--frozen -- Equivalent to specifying both --locked and --offline
--help -- Print help
--locked -- Assert that `Cargo.lock` will remain unchanged
--lockfile-path -- Path to Cargo.lock (unstable)
--manifest-path -- Path to Cargo.toml
--offline -- Run without accessing the network
--package -- Package to remove from
--quiet -- Do not print cargo log messages
--target -- Remove from target-dependencies
--verbose -- Use verbose output (-vv very verbose/build.rs output)
-Z -- Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details
rand serde_json
```
(on zsh)
### What does this PR try to resolve?
ref https://github.com/rust-lang/cargo/issues/14834
As described in the issue, we want to move IndexPackage into
cargo-util-schemas. However, it contains InternedString fields, which we
don't want to expose as part of the public API.
This PR replaces InternedString with Cow.
And also, as @weihanglo's suggested, I implemented the From/Into trait
to simplify code.
From Cow tarit implementation: [`42f593f`
(#15559)](42f593fa72)
Replace InternedString with `into()` across the whole codebase:
[`5f90098`
(#15559)](5f900981de)
I am unsure if it worsens the readability. Feel free to comment.
### How should we test and review this PR?
It shouldn't change or break any tests.
Benchmark 1:
https://github.com/rust-lang/cargo/pull/15559#issuecomment-2913155520
Benchmark 2:
https://github.com/rust-lang/cargo/pull/15559#issuecomment-2927304675
### Additional information
None
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.
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.
In #15639, @weihanglo noted that one of the lint tests passed in CI, but
locally it would fail as it had a hyperlink added to its output. The
root cause appears to be the recent update to `anstyle-svg@0.1.8`, which
added support for hyperlinks, combined with our hyperlink support
autodetection, disabling them in CI, but allowing them locally. To
ensure we are consistently handling hyperlinks, I made them always
enabled for UI tests. This seemed like the best option given that we
already force colors for UI tests, and it allows us to test our
hyperlink output.