Rollup merge of #145390 - joshtriplett:rustc-diag-value-earlier, r=lcnr

Shorten some dependency chains in the compiler

(I recommend reviewing this commit by commit.)

One of the long dependency chains in the compiler is:
- Many things depend on `rustc_errors`.
- `rustc_errors` depended on many things prior to this PR, including `rustc_target`, `rustc_type_ir`, `rustc_hir`, and `rustc_lint_defs`.
- `rustc_lint_defs` depended on `rustc_hir` prior to this PR.
- `rustc_hir` depends on `rustc_target`.
- `rustc_target` is large and takes a while.

This PR breaks that chain, through a few steps:
- The `IntoDiagArgs` trait, from `rustc_errors`, moves earlier in the dependency chain. This allows `rustc_errors` to stop depending on a pile of crates just to implement `IntoDiagArgs` for their types.
- Split `rustc_hir_id` out of `rustc_hir`, so crates that just need `HirId` and similar don't depend on all of `rust_hir` (and thus `rustc_target`).
- Make `rustc_lint_defs` stop depending on `rustc_hir`.
This commit is contained in:
Jacob Pratt 2025-08-21 01:12:17 -04:00 committed by GitHub
commit 62582eb78e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 508 additions and 456 deletions

View file

@ -1591,7 +1591,7 @@ mod snapshot {
insta::assert_snapshot!(
ctx.config("check")
.path("compiler")
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (73 crates)");
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (74 crates)");
}
#[test]
@ -1617,7 +1617,7 @@ mod snapshot {
ctx.config("check")
.path("compiler")
.stage(1)
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (73 crates)");
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (74 crates)");
}
#[test]
@ -1631,7 +1631,7 @@ mod snapshot {
[build] llvm <host>
[build] rustc 0 <host> -> rustc 1 <host>
[build] rustc 1 <host> -> std 1 <host>
[check] rustc 1 <host> -> rustc 2 <host> (73 crates)
[check] rustc 1 <host> -> rustc 2 <host> (74 crates)
");
}
@ -1647,7 +1647,7 @@ mod snapshot {
[build] rustc 0 <host> -> rustc 1 <host>
[build] rustc 1 <host> -> std 1 <host>
[check] rustc 1 <host> -> std 1 <target1>
[check] rustc 1 <host> -> rustc 2 <target1> (73 crates)
[check] rustc 1 <host> -> rustc 2 <target1> (74 crates)
[check] rustc 1 <host> -> rustc 2 <target1>
[check] rustc 1 <host> -> Rustdoc 2 <target1>
[check] rustc 1 <host> -> rustc_codegen_cranelift 2 <target1>
@ -1743,7 +1743,7 @@ mod snapshot {
ctx.config("check")
.paths(&["library", "compiler"])
.args(&args)
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (73 crates)");
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (74 crates)");
}
#[test]