Move attributes out of rustc_hir - #160336
Conversation
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred in compiler/rustc_hir/src/attrs |
|
@rustbot try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
0b1c8e0 to
cafdff7
Compare
|
@bors try |
This comment has been minimized.
This comment has been minimized.
Move attributes out of rustc_hir
|
Oops |
|
By the way I did a perf run on the other PR as well, see https://perf.rust-lang.org/compare.html?start=29e68fe2295f8fc2feb52b8cb0b61a055842fdcf&end=5bfd1598fde1f19d34aa3199461963dcce69bb0a&stat=instructions%3Au&tab=bootstrap But the rustc_symbol_mangling result is weird, let's see if that happens again. |
|
@mejrs What did you use to graph the dependencies? |
Also take a look at the |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (8ff9bde): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (primary -6.2%, secondary 0.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 0.5%, secondary -0.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 489.711s -> 487.73s (-0.40%) |
|
@mejrs wrote:
Thanks!
I'm familiar; I added the support for doing (I just sent a PR to rustc-dev-guide to document that.) |
This comment has been minimized.
This comment has been minimized.
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
|
Unknown command "note". Run |
|
@bors rollup=iffy note=likely to conflict |
|
@bors r+ |
…ouwer Move attributes out of rustc_hir Previous graph: <img width="397" height="503" alt="image" src="https://github.com/user-attachments/assets/f1c101b1-eb2f-4032-a8e7-6b4f6aef39d5" /> Graph with this pr: <img width="505" height="524" alt="image" src="https://github.com/user-attachments/assets/489be58e-41c5-4c08-a25a-9dc04ebe00e2" /> So while it doesn't really look like much (might be nicer for pipeling or if you're editing rustc_hir), it unblocks followup work to split up this part of the crate graph further, like: - moving `SanitizerSet` to a (new?) crate below `rustc_target` so that `rustc_target` and `rustc_attr_ir` no longer depend on each other and can compile in parallel - `rustc_session` will only depend on `rustc_hir` for `rustc_hir::definitions` in its `cstore` module, there may be something there but I haven't looked in depth. There's some work left wrt cleaning up imports everywhere, but that's for followups. r? @JonathanBrouwer
…uwer Rollup of 12 pull requests Successful merges: - #160336 (Move attributes out of rustc_hir) - #160715 (ignore tests with the GCC backend if we can't find `libgccjit.so` for the target) - #157609 (fix: build-std on 32 bit arm with 64 bit time) - #160613 (Add regression test for unsized non-last struct field with overlapping impls) - #160658 (miri: implement more restrictive trivial-ABI checks) - #160704 (sort lint names in lint pass declarations) - #160707 (Add regression test for higher ranked fn pointer impl not general enough) - #160713 (Add regression test for #135287) - #160720 (triagebot: add ubiratan to infra-ci) - #160747 (rustc_errors: remove unused code) - #160751 (Add regression test for incremental borrowck ICE with generic const exprs) - #160753 (rustc_lint: remove unused rustc_attrs feature) Failed merges: - #158835 (rustc_passes: lint unused `#[path]` attributes on inline modules)
Rollup merge of #160336 - mejrs:move_attribute, r=JonathanBrouwer Move attributes out of rustc_hir Previous graph: <img width="397" height="503" alt="image" src="https://github.com/user-attachments/assets/f1c101b1-eb2f-4032-a8e7-6b4f6aef39d5" /> Graph with this pr: <img width="505" height="524" alt="image" src="https://github.com/user-attachments/assets/489be58e-41c5-4c08-a25a-9dc04ebe00e2" /> So while it doesn't really look like much (might be nicer for pipeling or if you're editing rustc_hir), it unblocks followup work to split up this part of the crate graph further, like: - moving `SanitizerSet` to a (new?) crate below `rustc_target` so that `rustc_target` and `rustc_attr_ir` no longer depend on each other and can compile in parallel - `rustc_session` will only depend on `rustc_hir` for `rustc_hir::definitions` in its `cstore` module, there may be something there but I haven't looked in depth. There's some work left wrt cleaning up imports everywhere, but that's for followups. r? @JonathanBrouwer
…uwer Rollup of 12 pull requests Successful merges: - rust-lang/rust#160336 (Move attributes out of rustc_hir) - rust-lang/rust#160715 (ignore tests with the GCC backend if we can't find `libgccjit.so` for the target) - rust-lang/rust#157609 (fix: build-std on 32 bit arm with 64 bit time) - rust-lang/rust#160613 (Add regression test for unsized non-last struct field with overlapping impls) - rust-lang/rust#160658 (miri: implement more restrictive trivial-ABI checks) - rust-lang/rust#160704 (sort lint names in lint pass declarations) - rust-lang/rust#160707 (Add regression test for higher ranked fn pointer impl not general enough) - rust-lang/rust#160713 (Add regression test for rust-lang/rust#135287) - rust-lang/rust#160720 (triagebot: add ubiratan to infra-ci) - rust-lang/rust#160747 (rustc_errors: remove unused code) - rust-lang/rust#160751 (Add regression test for incremental borrowck ICE with generic const exprs) - rust-lang/rust#160753 (rustc_lint: remove unused rustc_attrs feature) Failed merges: - rust-lang/rust#158835 (rustc_passes: lint unused `#[path]` attributes on inline modules)
Remove rustc_middle dependency on rustc_hir_pretty There is a `impl PpAnn for TyCtxt` that is unneeded. None of the big crates (middle, trait_selection) actually do any hir pretty printing so it can be removed and can either be implemented for local structs elsewhere or done by casting to `&dyn PpAnn` instead. This probably doesn't have any perf effects (its not bottlenecking in timings) but I expect it to compose with rust-lang/rust#160336 and its followup works quite well. Old graph: <img width="1999" height="2171" alt="graph" src="https://github.com/user-attachments/assets/756e6a50-a413-4a8d-a0f3-7bbf4de07933" /> New graph: <img width="1853" height="2171" alt="graph_hir_pretty" src="https://github.com/user-attachments/assets/f9607e5a-d00b-4a86-8f6a-cefb45b75ad7" />
split up `rustc_session` Followup on rust-lang#160336 cc @JonathanBrouwer (feel free to review if you want) The first commit splits out the `cstore` module from `rustc_session` into its own crate. `rustc_session` actually never used it anywhere internally, and there are also several crates that only depend on `rustc_session` for it. So it is a natural candidate to split off. The second commit is similar; `rustc_hir::definitions` is moved to `rustc_hir_id`; it is used nowhere in `rustc_hir`, except to implement an inherent method: ```rust impl DefKind { pub fn def_path_data(self, name: Option<Symbol>) -> DefPathData { } } ``` which is used (once) in rustc_middle, so the items in `rustc_hir::definitions` and this conversion function could be in many places. `rustc_hir_id` is the earliest and the easiest, so that's what I went with. Together these allow `rustc_crate_store`, `rustc_hir` and `rustc_session` to compile in parallel. Current graph: <img width="825" height="617" alt="image" src="https://github.com/user-attachments/assets/aa954265-0057-4596-a7c4-38290937fb74" /> Graph after this pr: <img width="853" height="572" alt="image" src="https://github.com/user-attachments/assets/9bcd16f8-897c-4990-920b-249500b2e78e" />
split up `rustc_session` Followup on rust-lang#160336 cc @JonathanBrouwer (feel free to review if you want) The first commit splits out the `cstore` module from `rustc_session` into its own crate. `rustc_session` actually never used it anywhere internally, and there are also several crates that only depend on `rustc_session` for it. So it is a natural candidate to split off. The second commit is similar; `rustc_hir::definitions` is moved to `rustc_hir_id`; it is used nowhere in `rustc_hir`, except to implement an inherent method: ```rust impl DefKind { pub fn def_path_data(self, name: Option<Symbol>) -> DefPathData { } } ``` which is used (once) in rustc_middle, so the items in `rustc_hir::definitions` and this conversion function could be in many places. `rustc_hir_id` is the earliest and the easiest, so that's what I went with. Together these allow `rustc_crate_store`, `rustc_hir` and `rustc_session` to compile in parallel. Current graph: <img width="825" height="617" alt="image" src="https://github.com/user-attachments/assets/aa954265-0057-4596-a7c4-38290937fb74" /> Graph after this pr: <img width="853" height="572" alt="image" src="https://github.com/user-attachments/assets/9bcd16f8-897c-4990-920b-249500b2e78e" />
split up `rustc_session` Followup on rust-lang#160336 cc @JonathanBrouwer (feel free to review if you want) The first commit splits out the `cstore` module from `rustc_session` into its own crate. `rustc_session` actually never used it anywhere internally, and there are also several crates that only depend on `rustc_session` for it. So it is a natural candidate to split off. The second commit is similar; `rustc_hir::definitions` is moved to `rustc_hir_id`; it is used nowhere in `rustc_hir`, except to implement an inherent method: ```rust impl DefKind { pub fn def_path_data(self, name: Option<Symbol>) -> DefPathData { } } ``` which is used (once) in rustc_middle, so the items in `rustc_hir::definitions` and this conversion function could be in many places. `rustc_hir_id` is the earliest and the easiest, so that's what I went with. Together these allow `rustc_crate_store`, `rustc_hir` and `rustc_session` to compile in parallel. Current graph: <img width="825" height="617" alt="image" src="https://github.com/user-attachments/assets/aa954265-0057-4596-a7c4-38290937fb74" /> Graph after this pr: <img width="853" height="572" alt="image" src="https://github.com/user-attachments/assets/9bcd16f8-897c-4990-920b-249500b2e78e" />
Rollup merge of #160924 - mejrs:split_cstore, r=JonathanBrouwer split up `rustc_session` Followup on #160336 cc @JonathanBrouwer (feel free to review if you want) The first commit splits out the `cstore` module from `rustc_session` into its own crate. `rustc_session` actually never used it anywhere internally, and there are also several crates that only depend on `rustc_session` for it. So it is a natural candidate to split off. The second commit is similar; `rustc_hir::definitions` is moved to `rustc_hir_id`; it is used nowhere in `rustc_hir`, except to implement an inherent method: ```rust impl DefKind { pub fn def_path_data(self, name: Option<Symbol>) -> DefPathData { } } ``` which is used (once) in rustc_middle, so the items in `rustc_hir::definitions` and this conversion function could be in many places. `rustc_hir_id` is the earliest and the easiest, so that's what I went with. Together these allow `rustc_crate_store`, `rustc_hir` and `rustc_session` to compile in parallel. Current graph: <img width="825" height="617" alt="image" src="https://github.com/user-attachments/assets/aa954265-0057-4596-a7c4-38290937fb74" /> Graph after this pr: <img width="853" height="572" alt="image" src="https://github.com/user-attachments/assets/9bcd16f8-897c-4990-920b-249500b2e78e" />
Remove rustc_middle dependency on rustc_hir_pretty There is a `impl PpAnn for TyCtxt` that is unneeded. None of the big crates (middle, trait_selection) actually do any hir pretty printing so it can be removed and can either be implemented for local structs elsewhere or done by casting to `&dyn PpAnn` instead. This probably doesn't have any perf effects (its not bottlenecking in timings) but I expect it to compose with rust-lang/rust#160336 and its followup works quite well. Old graph: <img width="1999" height="2171" alt="graph" src="https://github.com/user-attachments/assets/756e6a50-a413-4a8d-a0f3-7bbf4de07933" /> New graph: <img width="1853" height="2171" alt="graph_hir_pretty" src="https://github.com/user-attachments/assets/f9607e5a-d00b-4a86-8f6a-cefb45b75ad7" />
Update deprecated rustc_hir imports Followup to rust-lang#160336 That's ~half of them, I'm not doing it all in one go to reduce conflicts.
Update deprecated rustc_hir imports Followup to rust-lang#160336 That's ~half of them, I'm not doing it all in one go to reduce conflicts.
View all comments
Previous graph:
Graph with this pr:
So while it doesn't really look like much (might be nicer for pipeling or if you're editing rustc_hir), it unblocks followup work to split up this part of the crate graph further, like:
SanitizerSetto a (new?) crate belowrustc_targetso thatrustc_targetandrustc_attr_irno longer depend on each other and can compile in parallelrustc_sessionwill only depend onrustc_hirforrustc_hir::definitionsin itscstoremodule, there may be something there but I haven't looked in depth.There's some work left wrt cleaning up imports everywhere, but that's for followups.
r? @JonathanBrouwer