20649 Commits

Author SHA1 Message Date
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
Ed Page
05bf93cf8f
chore: Address most typos (#15911)
This PR addresses typos found using
[`typos`](https://github.com/crate-ci/typos) (config file below)
<details>
  <summary>typos.toml</summary>

  ```toml
  # Files to ignore
  [files]
  extend-exclude = ["LICENSE-THIRD-PARTY"]

  [default]
extend-ignore-identifiers-re =
["\\bTLS_[A-Z0-9_]+(_anon_[A-Z0-9_]+)?\\b"]
  extend-ignore-re = [
    # Handles git short SHA-1 hashes
    "[a-f0-9]{8,9}",
    # Handles ssh keys
    "AAAA[0-9A-Za-z+/]+[=]{0,3}",
    # Handles paseto from login tests
    "k3[.](secret|public)[.][a-zA-Z0-9_-]+",
  ]

  [default.extend-identifiers]
  rela_path = "rela_path"
  rela_pkg_root = "rela_pkg_root"
  rela_root = "rela_root"
  SSHed = "SSHed"
  # Allow these "words" in all files
  [default.extend-words]
  aout = "aout"
  ba = "ba"
  EXCED = "EXCED"
  filetimes = "filetimes"
  flate = "flate"
  fing = "fing"
  fo = "fo"
  lits = "lits"
  mis = "mis"
  objekt = "objekt"
  zuser = "zuser"

  # Allow these words in specific files
  [type.bad_config]
  extend-glob = ["bad_config.rs"]
  extend-words.bulid = "bulid"

  [type.makro]
  extend-glob = ["makro.rs", "proc-macro-observer.rs"]
  extend-words.makro = "makro"

  ```

</details>
2025-09-03 01:00:49 +00:00
Scott Schafer
022dc5b381
chore: Address most typos 2025-09-02 18:15:50 -06:00
Ed Page
37b85ad987
chore(deps): update rust crate annotate-snippets to 0.12.1 (#15909)
This PR updates `annotate-snippets` to `0.12.1`.
2025-09-02 22:16:19 +00: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
96aec67d25
refactor: Cleanup lint message creation 2025-09-02 15:43:37 -06:00
Scott Schafer
2ef151bdc9
fix: Emit inline help after first snippet 2025-09-02 15:43:37 -06:00
Scott Schafer
eec0473bea
refactor: Make get_span return the key and value span 2025-09-02 15:43:37 -06:00
Ed Page
c8a15f324f fix(publish): Don't generate final artifacts 2025-09-02 15:29:04 -05:00
Ed Page
474598e3d7 refactor(package): Make steps explicit 2025-09-02 15:15:52 -05:00
Ed Page
3f857e9dd4 test(publish): Show the build-dir behavior 2025-09-02 13:21:35 -05:00
Ed Page
67dc504f94 refactor(manifest): Simplify frontmatter editing 2025-09-02 10:50:26 -05:00
Ed Page
e9c744b8de refactor(frontmatter): Track spans
This will make error reporting easier as well as editing
2025-09-02 10:50:26 -05:00
Ed Page
3184f03ef3 refactor(frontmatter): Switch to winnow 2025-09-02 10:50:06 -05:00
Ed Page
8745e27805 refactor(frontmatter): Extract strip_ws_lines 2025-09-02 10:49:46 -05:00
Ed Page
84cc6ceba7 refactor(frontmatter): Publicly expose strip_shebang 2025-09-02 10:49:46 -05:00
Ed Page
4483c29ca4 refactor(frontmatter): Pull out as a dedicated mod 2025-09-02 10:49:44 -05:00
Weihang Lo
7c4e67c1d4
test(script): Switch frontmatter tests to end-to-end (#15899)
### What does this PR try to resolve?

For frontmatter parser, we almost exclusively use unit tests.

This switches the rustc ui tests we've copied over to being cargo ui
tests but in a way that makes it relatively easy to diff against rustc
and see the state of the two and makes it easier to update.

This will help as I work to improve the errors reported by cargo to
align with rustc in quality

As part of this, I made the source file auto-updating whenever new tests
get copied over.

### How to test and review this PR?

### Notes

Note: the tests are a little ahead of rustc atm, being pulled from one
of my branches that I've not yet pushed because its blocked on another
PR
2025-09-02 14:42:50 +00:00