20639 Commits

Author SHA1 Message Date
Ed Page
db6891f244 fix(cli): Show the bad manifest path
In most cases, this will just be what you passed on the command line.
Even when its not, that likely represents a programmer error.

I mostly did this to help see what was the cause of a test failure.
2025-08-29 15:42:44 -05:00
Scott Schafer
19fb2c007e
feat: Don't stop at first error when emitting lints and warnings 2025-08-26 19:08:31 -06:00
Weihang Lo
a6c58d4305
test: avoid hardcoded target spec json (#15880)
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.

* https://github.com/rust-lang/rust/pull/144443
* https://github.com/rust-lang/rust/pull/145764#issuecomment-3216104449
* [#t-compiler > Is it possible to add a commit to a submodule? @
💬](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Is.20it.20possible.20to.20add.20a.20commit.20to.20a.20submodule.3F/near/535865215)
2025-08-26 23:05:12 +00:00
Weihang Lo
2c2e6836c9
test(add): Cover some frontmatter corner cases (#15886)
### What does this PR try to resolve?

When working with the frontmatter parser, I identified some corner cases
that we should cover.

I cannot think of a programmatic way to require escaping when going from
no frontmatter to a frontmatter or to require more escaping than is
already present.

### How to test and review this PR?
2025-08-26 21:08:12 +00:00
Ed Page
b54b92cc5f test(add): Ensure an empty frontmatter is handled properly
There are corner cases with empty frontmatters, so I wanted to ensure
this case works now and going forward
2025-08-26 15:12:19 -05:00
Ed Page
865dfe26d1 test(add): Ensure escaping is preserved
I cannot think of a programmatic way to require escaping when going from no frontmatter to a frontmatter
or to require more escaping than is already present.
2025-08-26 15:09:44 -05:00
Ed Page
0bfd820f83
Add more context to publish-failed error message (#15879)
## What does this PR try to resolve?

This PR fixes issue #15754 where workspace publish failures provided
non-actionable error messages. Previously, when publishing a workspace
failed (due to rate limiting or other errors), users only saw generic
errors like `[ERROR] failed to publish to registry` without knowing
which package failed or what packages remained to be published.

## How to test and review this PR?

**Testing**: Run `cargo test workspace_publish_rate_limit_error` to see
the improved behavior, then `cargo test publish` to ensure all tests
pass.

**Review**:
- **Commit 1**: Adds test demonstrating current problematic behavior
- **Commit 2**: Implements fix and updates test to expect improved
output

The fix transforms error messages from generic `failed to publish to
registry` to actionable `failed to publish 'package_a' v0.1.0; the
following crates have not been published yet: package_b v0.1.0,
package_c v0.1.0`. This improvement applies consistently across all
publish error scenarios, giving users clear information about what went
wrong and what remains to be done.
2025-08-26 16:39:05 +00:00
Ojus Chugh
d2a6dcb43e fix(publish): Show remaining packages to be published 2025-08-25 14:45:02 -05:00
Ojus Chugh
f36cb83e98 fix(publish): Report which package failed to publish 2025-08-25 14:44:29 -05:00
Ojus Chugh
688ec9e9ef test(publish): Add test demonstrating error messages during workspace publish rate limiting 2025-08-25 14:38:07 -05: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
Weihang Lo
623d536836
test(frontmatter): Match test updates in rustc (#15878)
### What does this PR try to resolve?

Sync our tests with rustc.

See rust-lang/rust#145751, rust-lang/rust#142032

### How to test and review this PR?
2025-08-22 19:05:52 +00:00
Ed Page
61cebf5c56 test(frontmatter): Match test updates in rustc
See rust-lang/rust#145751, rust-lang/rust#142032
2025-08-22 09:48:39 -05:00
Ed Page
12fa1daac8
chore: fix some typos in comment (#15877)
### What does this PR try to resolve?

fix some typos in comment

### How to test and review this PR?

No need.
2025-08-22 13:37:21 +00:00
xihuwenhua
e235d04c94 chore: fix some typos in comment
Signed-off-by: xihuwenhua <xihuwenhua@outlook.com>
2025-08-22 14:40:12 +08:00
Weihang Lo
15165cac21
Add Arm64 Windows CI jobs (#15790)
The `aarch64-pc-windows-msvc` target is on the path to being promoted to
Tier 1: <https://github.com/rust-lang/rfcs/pull/3817>

Adding Arm64 Windows runners will catch any potential issues in Cargo
before changes are merged in, instead of waiting for the Cargo submodule
to be updated.
2025-08-21 15:00:50 +00:00
Weihang Lo
4434ed8a2a
suggest workspace hints for boolean dependencies (#15507)
### What does this PR try to resolve?
via issue #15505, Cargo currently errors on
```toml
[dependencies]
crc32fast = true
```
with a message about `expected a version string or a detailed
dependency` It doesn’t hint that you can depend on a workspace member.
This PR updates `cargo` so that when you write dep = true, the error
also suggests:
```toml
dep = { workspace = true }
dep.workspace = true
```

### How should we test and review this PR?
In a workspace crate’s Cargo.toml, add
```toml
[dependencies]
crc32fast = true
```
Run `cargo build` and you should see the enhanced error with the two
workspace hints.

### Additional information

Regarding support for int/float, we only need a special case for boolean
because they’re the only values that get the `workspace hint`.
Everything else just uses the normal detailed dependency error
2025-08-21 14:31:55 +00:00
Weihang Lo
c0396feaa8
make UnitGenerator public in cargo-as-a-library (#15873)
### What does this PR try to resolve?

This PR makes `UnitGenerator` public for experimenting with unit graph
generation in cargo plumbing commands.

See https://github.com/crate-ci/cargo-plumbing/issues/39

### How to test and review this PR?

Verify that `UnitGenerator` is available when using cargo-as-a-library
2025-08-21 13:01:18 +00:00
Vito Secona
e633ba3adb refactor: make UnitGenerator public 2025-08-21 19:09:23 +07:00
Weihang Lo
81db0af861
Linting system (#15865)
This PR is just a few small improvements to the linting system.
2025-08-21 01:45:16 +00:00
Scott Schafer
069723ebff
fix(unknown_lints): Make emitted_source come before other groups 2025-08-19 16:19:40 -06:00
Scott Schafer
5ac9eb0a58
refactor(lints): Create emitted_source helper function 2025-08-19 16:19:40 -06:00
Scott Schafer
01a270f402
refactor: Add a helper for telling if a level is an error 2025-08-19 16:19:40 -06: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
Samuel Onoja
7e78c54630
initial test commit 2025-08-19 18:15:32 +01:00
Weihang Lo
af9f4f677a
docs: add back src/doc README.md 2025-08-18 18:32:38 -04:00
Weihang Lo
974efef192
docs(contrib): polish documentation guide and make it a chapter 2025-08-18 18:32:37 -04:00
Weihang Lo
bfc0a59ebe
docs(contrib): move docs building process to contributor guide 2025-08-18 18:25:37 -04:00
Ed Page
b2c0aea98d
Switch to using native mdbook fragment redirects (#15861)
Mdbook recently gained the ability to redirect fragments. This removes
the embedded scripts to use this mechanism instead.
2025-08-18 21:49:40 +00:00
Eric Huss
f8dc368fe3 Switch to using native mdbook fragment redirects
Mdbook recently gained the ability to redirect fragments. This removes
the embedded scripts to use this mechanism instead.
2025-08-18 14:21:36 -07:00
Eric Huss
1840e7a507
docs(profile): revert wrong statement of lto options' optimization (#15855)
There is no clear winner between fat LTO and ThinLTO, so don't say "from
most to least optimizing" here.

See https://github.com/rust-lang/cargo/pull/15841#discussion_r2281037386
2025-08-18 17:10:47 +00:00
Ed Page
dd69fab752
docs: avoid ambiguity between update and fetch (#15860)
address
<https://github.com/rust-lang/cargo/pull/15853#discussion_r2282734460>

r? epage
2025-08-18 16:45:29 +00:00
Weihang Lo
33baa940c0
docs: avoid ambiguity between update and fetch 2025-08-18 12:16:36 -04:00
Eric Huss
62537dd3ef
docs: mention how Cargo fetch git submodules (#15853)
### What does this PR try to resolve?

Clarify how git submodules are handled in Cargo for `git` dependencies.

See
https://github.com/rust-lang/cargo/issues/4247#issuecomment-3160707916
2025-08-18 15:21:27 +00:00
Weihang Lo
33cb1c2654
feat(unstable): Added -Zbuild-dir-new-layout unstable feature (#15848)
### What does this PR try to resolve?

Added `-Zbuild-dir-new-layout` unstable feature as part of #15010

I will open a follow up PR with an initial implementation as mentioned
[here](https://github.com/rust-lang/cargo/issues/15010#issuecomment-3193725891)

r? @weihanglo
2025-08-18 05:04:24 +00:00
Weihang Lo
bff04ca05e
docs(profile): revert wrong statement of lto options' optimization
There is no clear winner between fat LTO and ThinLTO,
so don't say "from most to least optimizing" here.

See https://github.com/rust-lang/cargo/pull/15841#discussion_r2281037386
2025-08-17 20:21:11 -04:00
Weihang Lo
206e3fe6b3
Implement host-target substitution (#15838)
### What does this PR try to resolve?

This PR resolves: https://github.com/rust-lang/cargo/issues/13051

Namely, it allows users to invoke cargo subcommands that accept a
`--target` directive to specify the `host` target, which is later
substituted in the command processing layer by the host's real target
triple (for instance, on most Linux distributions, `cargo build --target
host` would effectively run `cargo build --target
x86_64-unknown-linux-gnu`).

This additionally applies to usage within `config.toml`, like so:

```toml
# .cargo/config.toml

[build]
target = "host"
```
2025-08-18 00:01:34 +00:00
zdivelbiss
d5509ebacc
amend documentation style for host target specifier
We also rebuilt the manual pages, to ensure they're up-to-date with the changes made in the `host` target specifier PR.
2025-08-17 14:39:35 -05:00
Weihang Lo
65e7c7a817
docs: mention how Cargo fetch git submodules 2025-08-17 14:59:10 -04:00
zdivelbiss
8f66af7194
simplify tests for host target specifier 2025-08-17 12:54:22 -05:00
zdivelbiss
b23e0a99b2
documentation for host target specifier 2025-08-17 12:52:11 -05:00
zdivelbiss
b3f5e052f6
tests for host target specifier 2025-08-17 12:51:34 -05:00
zdivelbiss
7794d62ced
implement "host" target substitution 2025-08-17 12:51:29 -05:00
Weihang Lo
71eb84f21a
update tests to match lint message changes from rust-lang/rust#140794 (#15849)
Needed for
[rust-lang/rust#140794](https://github.com/rust-lang/rust/pull/140794)
(not merged yet).
2025-08-17 17:18:56 +00: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
9c7bc45bfa
chore: downgrade to libc@0.2.174 (#15851)
### What does this PR try to resolve?

There is incompatibility between rustix@1.0.8 and libc@0.2.175 that
leads to compilation errors.

See

* https://github.com/bytecodealliance/rustix/issues/1496
* https://github.com/rust-lang/rust/pull/145478#issuecomment-3193494156

### How to test and review this PR?

In rust-lang/rust, update the `src/tools/cargo` submodule accordingly,
and run

```
cargo run --manifest-path src/ci/citool/Cargo.toml run-local dist-loongarch64-musl
```

With this downgrade it should compile.
2025-08-17 16:05:32 +00:00
Weihang Lo
eae8d0dd30
Reorder lto options in profiles.md (#15841)
Aside from `false`, the `lto` options seem to be ordered from "most
optimizing" to "least optimizing".

If this interpretation is correct, then I think `false` should go
between `thin` and `off`.

cc: @ehuss (who I think wrote that text)
2025-08-17 15:36:33 +00:00
Weihang Lo
72dabb4487
chore: downgrade to libc@0.2.174
There is incompatibility between rustix@1.0.8 and libc@0.2.175 that
leads to compilation errors.

See

* https://github.com/bytecodealliance/rustix/issues/1496
* https://github.com/rust-lang/rust/pull/145478#issuecomment-3193494156
2025-08-17 10:37:29 -04:00
Samuel Moelius
396f8c62ed
Mention ordering rationale in profiles.md
Co-authored-by: Weihang Lo <weihanglo@users.noreply.github.com>
2025-08-17 10:29:42 -04:00