20648 Commits

Author SHA1 Message Date
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
Weihang Lo
faa4915898
feat(cli): Use ellipses when truncating progress (#15955)
### What does this PR try to resolve?

Use ellipses when truncating progress instead of three periods. While
this allows an extra two characters to fit on screen, the main
motivation it to reduce the visual quirkiness or the resulting output.

### How to test and review this PR?

This applies the review feedback left in #15330

Closes #15330
2025-09-12 02:02:39 +00:00
Hugo Osvaldo Barrera
d9891edffe feat(cli): Use ellipses when truncating progress
Use ellipses when truncating progress instead of three periods. While
this allows an extra two characters to fit on screen, the main
motivation it to reduce the visual quirkiness or the resulting output.

Closes #15330
2025-09-11 20:23:18 -05:00
Ed Page
00c7c805f0
feat(completer): Added completion for --features flag (#15309)
### What does this PR try to resolve?

This attempts to complete the autocompleter for `cargo build --features
<TAB>`, `cargo run --features <TAB>`

It loads all the features that are there in the profile section of
Cargo.toml

![Screenshot from 2025-03-14
03-36-53](https://github.com/user-attachments/assets/efeb07a1-60e0-4b77-bb47-05f39cd15fc7)

Related to #14520

### How should we test and review this PR?
by running `cargo build --features <TAB>`, `cargo run --features <TAB>`
2025-09-12 01:20:35 +00:00
Weihang Lo
4f2f1d71b9
fix(publish): Switch the 'ctrl-c on wait' line to a help message (#15942)
### What does this PR try to resolve?

Switches a multi-line note to use annotate_snippet directly in prep for
#15917 where these extra lines will be aligned with the first line.

### How to test and review this PR?

### Notes

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-12 01:18:24 +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
Eric Huss
7470eb0b04
docs: move docs building process to contributor guide (#15854)
### What does this PR try to resolve?

Pull
<71eb84f21a/src/doc/README.md>
into our contributor guide for visibility.

Also a writing guideline is added to the chapter, as well as some minor
polish.

This is created after seeing the contributing frictions in
<https://github.com/rust-lang/cargo/pull/15838#issuecomment-3194614286>.

### How to test and review this PR?

```
mdbook serve src/doc/contrib
```
2025-09-11 23:49:39 +00: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
782df7300d refactor(future): Separate out suggestions from rendering
This will make it easier later to put each in their own message/title in
annotate snippets.

The hack will be removed later in this series.
2025-09-11 17:15:42 -05:00
Ed Page
9e401f67f6 refactor(future): Group shell output 2025-09-11 17:15:42 -05:00
Ed Page
acf54a080e refactor(future): Group shell output 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
bd04a4c19a chore: Update annotate-snippets 2025-09-11 17:02:18 -05:00
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
e3f6477f26
fix(manifest): Show error source to users (#15939)
### What does this PR try to resolve?

Ooch our way towards rustc's quality of error reporting to make up for
the fact that users won't see most frontmatter rustc error messages.

### How to test and review this PR?

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-11 20:16:08 +00:00
Ed Page
24bb93c388
Bump miow to 0.60.1 (#15950)
Updates the `miow` crate to 0.60.1, which removes the final use of
`windows-sys` 0.48.0.
2025-09-10 23:16:07 +00:00
Daniel Paoliello
02a61a5bac Bump miow to 0.60.1 2025-09-10 15:40:53 -07:00
Weihang Lo
5d151a9ec3
test(help): Ensure consistent behavior regardless of rustup use (#15949)
### What does this PR try to resolve?

#15928 removed the fix from #13488 which breaks rust-lang/rust. This
fixes that and makes the test less brittle for the future.

### How to test and review this PR?
2025-09-10 20:59:13 +00:00
Ed Page
da2eafe024 test(help): Ensure consistent behavior regardless of rustup use 2025-09-10 15:25:35 -05:00
Jakub Beránek
5c1631ce62
Reword intro, remove nightly/unstable feature sub-headings, clarify Cranelift backend trade-offs, remove TODO 2025-09-10 16:52:51 +02:00
Weihang Lo
2a1de96590
docs(changelog): Clarify how manifest paths are used (#15946)
### What does this PR try to resolve?

I got confused by this when refreshing myself on the changelog in prep
for the 1.90 release.

### How to test and review this PR?
2025-09-10 14:26:27 +00:00
Ed Page
0d354726ea docs(changelog): Clarify how manifest paths are used
I got confused by this when refreshing myself on the changelog in prep
for the 1.90 release.
2025-09-10 08:50:44 -05:00
Ed Page
98402ac7a4
fix(flock): check if they are marked unsupported in libstd (#15941)
### What does this PR try to resolve?

This is a follow-up of <https://github.com/rust-lang/cargo/pull/15935>.

Before this Cargo invokes syscalls and check whether it gets ENOTSUP to
determine flock is unsupported. However, now the "unsupported platforms"
are pre-defined by libstd. Cargo should perhaps return unsupported if a
platform is marked unsupported by libstd.

Without this, some people on Termux may be affected I guess?

See
e9b6085088/library/std/src/sys/fs/unix.rs (L1395-L1410)
2025-09-09 20:19:39 +00:00
Weihang Lo
8f51d7f68b
fix(flock): check if they are marked unsupported in libstd
Before this Cargo invokes syscalls and check whether it gets ENOTSUP to
determine flock is unsupported. However, now the "unsupported platforms"
are pre-defined by libstd [1]. Cargo should perhaps return unsupported
if a platform is marked unsupported by libstd.

Without this, some people on Termux may be affected I guess?

[1]: e9b6085088/library/std/src/sys/fs/unix.rs (L1395-L1410)
2025-09-09 15:46:57 -04:00
Weihang Lo
78d83495ee
test(manifest): Fix test output order (#15940)
### What does this PR try to resolve?

As this is an unordered test, sometimes snapshot updating can mess up
the line order.

### How to test and review this PR?
2025-09-09 04:21:45 +00: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
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
1cd5223fa7 refactor(frontmatter): Track spans for errors 2025-09-08 16:06:14 -05:00
Ed Page
433457447c refactor(manifest): Clarify which diagnostic source 2025-09-08 15:58:48 -05:00
Ed Page
378bc91cd6 fix(frontmatter): Be more precise in multi-frontmatter error 2025-09-08 15:53:58 -05:00
Ed Page
e49cd3dd35 refactor(frontmatter): Re-structure errors for easier span capturing 2025-09-08 15:44:00 -05:00
Ed Page
f55f79021b refactor(frontmatter): Switch to custom error type 2025-09-08 15:38:18 -05:00
Weihang Lo
9eb32405e9
refactor(shell): Simplify some code (#15937)
### What does this PR try to resolve?

This is from some review feedback left on #15917 which was merged in
#15920.

### How to test and review this PR?
2025-09-08 20:25:04 +00:00
Ed Page
0e07ceb3f3
fix(manifest): Report script manifest errors for the right line number (#15927)
### What does this PR try to resolve?

Currently, if you have a manifest parse error for a cargo script, the
line number will be relative to the start of the frontmatter and not the
source file. This changes it so we get the line number relative to the
start of the source file.

### How to test and review this PR?

### Notes

To do this, I added span tracking to our frontmatter parser. To make
this easier, I used some helpers from winnow which is an existing
transitive dependency.

This span tracking will also come into use when I change the frontmatter
parser to start reporting spans in errors so we get annotated snippets
of source in the error messages to users.
2025-09-08 19:59:42 +00:00
Ed Page
334f66054b refactor(shell): Simplify some code
This is from some review feedback left on #15917 which was merged
in #15920.
2025-09-08 14:32:05 -05:00
Ed Page
0603e4e3b5 docs(frontmatter): Clarify each ScriptSource field's intent 2025-09-08 14:26:28 -05:00
Eric Huss
a9e120f95e
refactor: replace flock with std flock (#15935)
### What does this PR try to resolve?

Replace flock with std flock.

### How to test and review this PR?

Given we've supported Oracle since 2022-12 and don't want to break
people,
this is blocked on std supporting flock emulation via fcntl
rust-lang/rust#146269
2025-09-08 15:12:30 +00: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
Weihang Lo
8ec1a522f7
refactor: replace flock with std flock
Given we've supported Oracle since 2022-12
and don't want to break people,
this is blocked on std supporting flock emulation via fcntl
rust-lang/rust 146269
2025-09-06 07:49:29 -04:00
Jakub Beránek
df7e02dbf0
Split text into two sections 2025-09-06 11:36:41 +02:00
Eric Huss
3b379fcc54
fix: Switch from --nocapture to --no-capture (#15930)
### What does this PR try to resolve?

`--no-capture` was added in 1.88, with `--nocapture` being
soft-deprecated.

### How to test and review this PR?
2025-09-05 22:49:01 +00:00
Ed Page
fa10d65e8e
Render individual compilation sections in --timings pipeline graph (#15923)
### What does this PR try to resolve?
This PR expands the support for `--json-timings` (added in
https://github.com/rust-lang/cargo/pull/15780), by rendering the
individual compilation sections in the pipeline graph of the `--timings`
page.

Before, the linking section was only shown in the table at the bottom of
the page, now it should also be clearly visible in the compilation
graph, which should help more quickly understand how much time is spent
in linking.

<img width="1219" height="358" alt="image"
src="https://github.com/user-attachments/assets/71d0200d-4175-43b7-8aab-997008e2af47"
/>

I also added a legend to the pipeline graph, to explain what do the
colors mean.
<img width="338" height="118" alt="image"
src="https://github.com/user-attachments/assets/69f9bac6-c33f-44c5-8e45-afa97f314e4c"
/>

One wart is that the linking time actually ends a bit before the unit
ends, so there is some "vacuum" at the end where rustc does cleanup,
persists files to disk, deallocates things, etc. That's why I marked the
blue section "Frontend/rest" in the legend.

### How to test and review this PR?
Same as for https://github.com/rust-lang/cargo/pull/15780, e.g.:
```bash
export RUSTC=`rustup +nightly which rustc`
target/debug/cargo build -Zsection-timings --timings
```
on some crate, e.g. [ripgrep](https://github.com/BurntSushi/ripgrep).
2025-09-05 16:05:01 +00:00