7266 Commits

Author SHA1 Message Date
Ed Page
1865ef6834 fix(frontmatter): Try alternative len code fences
Of the non-ideal error cases mentioned in #15939, this is likely the one
people will hit the most and so important for us to improve.
2025-09-11 15:59:11 -05:00
Weihang Lo
6d221efc4d
fix(future): Report all content as a single Report (#15943)
### What does this PR try to resolve?

This changes the future-incompat message to be reported in a single
`Report`. The primary motivation is to cleanup the output compared to
taking the existing note's and aligning all content with the first line
which is what would happen otherwise in #15917.

In preparation for this, the message was cleaned up and made more like
what a rustc message might look like.

### How to test and review this PR?
2025-09-12 18:23:40 +00:00
Josh Triplett
840aff8377 Eliminate the last three "did you mean" warning phrasings
Inspired by https://github.com/rust-lang/cargo/pull/15138 , this
eliminates the last three instances.

Also rephrase a comment that implied the use of "did you mean"
suggestions.
2025-09-12 08:48:47 -05:00
Weihang Lo
b10679fc26
fix(info): Suggest a more universal cargo tree command (#15954)
### What does this PR try to resolve?

Passing a package to `--package` is for workspace members; we need to
pass it to `--invert`.

### How to test and review this PR?

This is part of #14993

While I think we should instead improve the `cargo tree` command to help
users with `--all-features`, we can at least take the other improvement
from #14991.
2025-09-12 13:00:22 +00:00
Craig Macomber
5ed8d67df9 fix(info): Suggest a more universal cargo tree command
Passing a package to `--package` is for workspace members; we need to
pass it to `--invert`.

This is part of #14993
2025-09-11 20:10:02 -05:00
Ed Page
2c5b4dfca9 fix(future): Report all content as a single Report 2025-09-11 17:15:42 -05:00
Ed Page
8e1cdcfb55 fix(future): Remove gap between item and its children 2025-09-11 17:15:42 -05:00
Ed Page
54ce51c343 fix(future): Lead with non-capital letter
Per rustc dev guide
2025-09-11 17:15:42 -05:00
Ed Page
155255fe41 fix(future): Lead with the suggested action 2025-09-11 17:15:42 -05:00
Ed Page
95aa52c177 fix(future): Indent potential candidates
This better matches other sub-lists
2025-09-11 17:15:42 -05:00
Ed Page
1b9265ca73 fix(future): Remove leading newline to match note conventions 2025-09-11 17:15:42 -05:00
Ed Page
8682394e7b fix(future): Be consistent in suggestion spacing 2025-09-11 17:15:42 -05:00
Ed Page
322b82a2e0 test(future): Serialize output to avoid unordered
Parallel isn't part of this test and it makes snapshot updating
annoying.
2025-09-11 17:15:42 -05:00
Ed Page
5736aad97a fix(publish): Switch the 'ctrl-c on wait' line to a help message
Unsure if this should be two groups or one group with a message.

If its one group, then we'll have a decorative line and then the `help:`
will be further indented.

I went with what is closer to how we do things today.  We can always
re-evaluate at a later point.
2025-09-11 17:02:25 -05:00
Ed Page
90b68c87f4 fix(manifest): Show error source to users
Several parts of this are not ideal yet
- Frontmatter close should show the open and show the EOF, instead of
  pointing at the open
- Trailing content on close will usually have a newline
- Multiple frontmatters should show the original frontmatter
- Some content, like supported infostrings, should go in a help
- Ideally we try to recover on no closing and instead point out a
  mismatched open/close

But this is still an improvement over nothing!
2025-09-08 16:06:29 -05:00
Ed Page
da2eafe024 test(help): Ensure consistent behavior regardless of rustup use 2025-09-10 15:25:35 -05:00
Ed Page
2e231072f4 test(manifest): Fix test output order
As this is an unordered test, sometimes snapshot updating can mess up
the line order.
2025-09-08 21:04:05 -05:00
Ed Page
4909d78973 fix(frontmatter): Report script manifest errors for the right line number 2025-09-04 16:15:04 -05:00
Ed Page
578ab7cc45 test(script): Show line numbers are off 2025-09-04 14:56:33 -05:00
Weihang Lo
3ceb2cb250
fix(cli): Adjust messages to match rustc (#15928)
### What does this PR try to resolve?

Fixes #12740

This is also prep for #15917, #15922

Changes:
- `note` changes from Cyan to Bright Green
- `cargo info` had to be changed because the header and context colors
became the same
- Switch to Bright colors which is usually redundant with Bold but that
is theme dependent
- `warning` only changes to Bright on Windows which is to work around a
shell issue on some Windows versions
  - except for `PLACEHOLDER` to tell it apart from `LITERAL`
- the `:` in `note:` is no longer bolded to match rustc

### How to test and review this PR?

### Notes

While annotate-snippets does not have a style for every one of our
styles, I updated our manual styles to be similar to annotate snippets.

For annotate snippets color definitions, see
d38b08b81d/src/renderer/mod.rs (L41-L78)
2025-09-08 04:10:39 +00:00
Ed Page
19f1d1561c fix: Switch from --nocapture to --no-capture
`--no-capture` was added in 1.88, with `--nocapture` being
soft-deprecated.
2025-09-05 10:33:00 -05:00
Ed Page
eac1ad1cd3 fix(shell): Don't bold the colon after error/warn/note 2025-09-05 09:40:24 -05:00
Ed Page
883cbb22e5 test(credential): Switch more expected results to snapshots
Had to deal with manually updating these when changing notes
2025-09-05 09:24:38 -05:00
Ed Page
7d6d673e23 fix(cli): Adjust terminal styles to match rustc
Fixes #12740
2025-09-04 16:35:40 -05:00
Ed Page
c8a15f324f fix(publish): Don't generate final artifacts 2025-09-02 15:29:04 -05:00
Ed Page
3f857e9dd4 test(publish): Show the build-dir behavior 2025-09-02 13:21:35 -05:00
Scott Schafer
022dc5b381
chore: Address most typos 2025-09-02 18:15:50 -06:00
Scott Schafer
d36c326926
chore(deps): update rust crate annotate-snippets to 0.12.1 2025-09-02 15:43:38 -06:00
Scott Schafer
2ef151bdc9
fix: Emit inline help after first snippet 2025-09-02 15:43:37 -06:00
Ed Page
57c97cc190 test(script): Switch frontmatter tests to end-to-end
This will make it easier to validate error improvements I'm working on
as well as make it easier to update from rust-lang/rust
2025-08-29 16:11:59 -05:00
Ed Page
79b6548c13 test(script): Pull out test mod 2025-08-29 16:11:59 -05:00
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
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
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
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
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
Scott Schafer
069723ebff
fix(unknown_lints): Make emitted_source come before other groups 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
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
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
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
Karol Zwolak
fb046a1354 update tests to match lint message changes from rust-lang/rust#140794 2025-08-17 18:50:55 +02:00