20616 Commits

Author SHA1 Message Date
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
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
Jakub Beránek
80912b6ac5
Add "Other" section after linking 2025-09-05 17:32:55 +02:00
Jakub Beránek
124374846a
Add legend to pipeline graph 2025-09-05 17:24:27 +02:00
Jakub Beránek
2dc90bb6b7
Add a function to draw a legend 2025-09-05 17:24:27 +02:00
Jakub Beránek
69171b7e81
Render link time in pipeline graph 2025-09-05 17:24:26 +02:00
Jakub Beránek
97ec21d911
Add configuration changes section 2025-09-05 17:22:02 +02:00
Jakub Beránek
5940262a4a
Reword with focus on trade-offs 2025-09-05 16:59:26 +02:00
Scott Schafer
43bb5c958b
test(credential): Switch more expected results to snapshots (#15929)
### What does this PR try to resolve?

Had to deal with manually updating these when changing notes.
This will avoid that.

### How to test and review this PR?
2025-09-05 14:59:15 +00: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
c6ebabd555 chore: Update annotate-snippets 2025-09-04 16:32:13 -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
Eric Huss
a154b100bc
refactor(cli): Pull out error chain iteration (#15926)
### What does this PR try to resolve?

This is some cleanup that will help with #15922

### How to test and review this PR?
2025-09-04 15:36:24 +00:00
Jakub Beránek
79f56d5437
Fix typo
Co-authored-by: Nicholas Nethercote <n.nethercote@gmail.com>
2025-09-04 17:04:27 +02:00
Jakub Beránek
7b6d35f06a
Add "Optimizing Build Performance" section to the Cargo book 2025-09-04 12:15:11 +02:00
Jakub Beránek
18915936bd
Generalize section rendering in pipeline graph 2025-09-04 10:16:38 +02:00
Jakub Beránek
8cacc027af
Remove unused Serialize derive 2025-09-04 09:59:47 +02:00
Weihang Lo
761c4658d0
refactor(shell): Prepare for Reports being generated in more places (#15920)
### What does this PR try to resolve?

This is preparation for changes like #15917 where we start to use
`annotate_snippets::Report` for handling more of the rendering of our
user messages to be more consistent with rustc and more feature rich in
what we are able to render.

### How to test and review this PR?
2025-09-04 01:25:01 +00:00
Ed Page
4d341c9925 refactor(cli): Pull out error chain iteration 2025-09-03 20:17:04 -05:00
Ed Page
a74370460b refactor(cli): Remove unused return value 2025-09-03 20:09:32 -05:00
Eric Huss
73cedc28a9
refactor(frontmatter): Pull out as a dedicated mod (#15914)
### What does this PR try to resolve?

This sets up the frontmatter logic as being more standalone in prep for
- Adding a custom error type that tracks spans for a more rustc-like
error experience
- Potentially moving this out into a dedicated package

### How to test and review this PR?

### Notes

Had this sitting around for a while but haven't been able to finish the
work that builds on it so wanted this merged to reduce conflicts.
2025-09-04 00:57:43 +00:00
Eric Huss
c50bb1860b
chore: downgrade to libc@0.2.174 (#15918)
### What does this PR try to resolve?

We have downgraded this in rust-lang/cargo#15851
We should also let renovate ignore it.

This also again downgrades libc to 0.2.174 again.

See
<https://github.com/rust-lang/rust/pull/146176#issuecomment-3251098344>.
2025-09-04 00:42:40 +00:00
Weihang Lo
9c4007c6f4
chore(ci): ignore libc from renovate updates
We have downgraded this in rust-lang/cargo#15851
We should also let renovate ignore it.
2025-09-03 16:43:58 -07:00
Weihang Lo
05aca0bded
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.
2025-09-03 16:36:45 -07:00
Ed Page
642411f01a refactor(shell): Allow callers to opt-in to quiet filtering 2025-09-03 15:59:18 -05:00
Ed Page
e3e2b07290 fix(shell): Clear lines for Reports 2025-09-03 15:48:09 -05:00
Ed Page
30e00d90f5 fix(shell): Add trailing newline to reports 2025-09-03 15:47:22 -05:00
Ed Page
d9d6c4a651 refactor(shell): Make print_report consistent with message_stder 2025-09-03 15:45:45 -05:00
Ed Page
da303f74fc refactor(shell): Remove redundant verbosity check 2025-09-03 15:44:29 -05:00
Weihang Lo
78a5531ed6
fix(publish): Don't generate final artifacts (#15910)
### What does this PR try to resolve?

When splitting `build-dir` out of `target-dir` (see #14125), we kept
`.crate` files as final artifacts of `cargo package`. However, that also
made them final artifacts of `cargo publish` when the side effect of
that should be the publish operation.

This changes things so that we instead package within `build-dir` and
`cargo package` then uplifts these to `target-dir`.

Behavior change: when running `cargo publish` without `build-dir` set,
`target/package/*.crate` will be moved to
`target/package/tmp-crate/*.crate`. This should be fine as its an
intermediate artifact but there is a risk that this can break someone
who did not realize that. Part of the reason for making the `build-dir`
/ `target-dir` split is to make our intermediate/final artifact intent
clearer. We did intend to be a transition period before changing things,
like with #15010. I'm assuming its fine that we don't have a transition
period here.

### How to test and review this PR?

### Notes

This was discussed at [#t-cargo > &#96;-Zbuild-dir&#96; and &#96;cargo
publish&#96; / &#96;cargo package&#96; @
💬](https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/.60-Zbuild-dir.60.20and.20.60cargo.20publish.60.20.2F.20.60cargo.20package.60/near/537336819)
2025-09-03 17:46:38 +00:00