MGCA: pretty printing for struct expressions and tuple calls #150695
Merged
bors merged 1 commit intorust-lang:mainfrom Jan 6, 2026
Merged
MGCA: pretty printing for struct expressions and tuple calls #150695bors merged 1 commit intorust-lang:mainfrom
bors merged 1 commit intorust-lang:mainfrom
Conversation
Collaborator
|
|
BoxyUwU
reviewed
Jan 5, 2026
compiler/rustc_hir_pretty/src/lib.rs
Outdated
| @@ -1138,15 +1138,58 @@ impl<'a> State<'a> { | |||
| fn print_const_arg(&mut self, const_arg: &hir::ConstArg<'_>) { | |||
| match &const_arg.kind { | |||
| // FIXME(mgca): proper printing for struct exprs | |||
Member
|
I think we probably do want to print const blocks 🤔 The best way to accomplish that is likely to change the printing for |
Member
|
I think you can write a test for this by adding |
77f1280 to
1e11627
Compare
Member
Author
not sure about how to make it yet, will take a look for it a bit later, for now just added a test and rewrited with |
BoxyUwU
reviewed
Jan 5, 2026
1e11627 to
85c8e41
Compare
Member
|
thanks @bors r+ rollup |
Collaborator
29 tasks
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Jan 6, 2026
MGCA: pretty printing for struct expressions and tuple calls
not sure
1. if there any tests that i need to adjust
2. if i should add any test for it
3. if humanity has come up with anything better than checking if that's first iteration or not with flag when printing sequences with separator
in case there is no tests for it and i dont have to add any, there is a demonstration of this ✨ pretty ✨ printing (this is output from `-Z unpretty=hir`)
```
fn test_errors<const N:
usize>() {
// accepts_enum::<{ None::<u32> }>();
accepts_point::<Point1 { a: N, b: N }>();
accepts_point::<Point(N, N)>();
}
```
btw it does not print const block
for this
```
accepts_point::<{ Point1 { a: const {N + 1}, b: N } }>();
```
it will print
```
accepts_point::<Point1 { a: { N + 1 }, b: N }>();
```
not sure if we want to print const blocks or not
r? BoxyUwU
bors
added a commit
that referenced
this pull request
Jan 6, 2026
Rollup of 8 pull requests Successful merges: - #144113 (Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items) - #149880 (rustc_codegen_llvm: update alignment for double on AIX) - #150668 (Unix implementation for stdio set/take/replace) - #150670 (THIR pattern building: Move all `thir::Pat` creation into `rustc_mir_build::thir::pattern`) - #150695 (MGCA: pretty printing for struct expressions and tuple calls ) - #150698 (Improve comment clarity in candidate_may_shadow) - #150706 (Update wasm-component-ld) - #150710 (Update libc dependency of std) r? `@ghost` `@rustbot` modify labels: rollup
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Jan 6, 2026
MGCA: pretty printing for struct expressions and tuple calls
not sure
1. if there any tests that i need to adjust
2. if i should add any test for it
3. if humanity has come up with anything better than checking if that's first iteration or not with flag when printing sequences with separator
in case there is no tests for it and i dont have to add any, there is a demonstration of this ✨ pretty ✨ printing (this is output from `-Z unpretty=hir`)
```
fn test_errors<const N:
usize>() {
// accepts_enum::<{ None::<u32> }>();
accepts_point::<Point1 { a: N, b: N }>();
accepts_point::<Point(N, N)>();
}
```
btw it does not print const block
for this
```
accepts_point::<{ Point1 { a: const {N + 1}, b: N } }>();
```
it will print
```
accepts_point::<Point1 { a: { N + 1 }, b: N }>();
```
not sure if we want to print const blocks or not
r? BoxyUwU
bors
added a commit
that referenced
this pull request
Jan 6, 2026
Rollup of 8 pull requests Successful merges: - #144113 (Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items) - #149880 (rustc_codegen_llvm: update alignment for double on AIX) - #150412 (use PIDFD_GET_INFO ioctl when available) - #150668 (Unix implementation for stdio set/take/replace) - #150670 (THIR pattern building: Move all `thir::Pat` creation into `rustc_mir_build::thir::pattern`) - #150695 (MGCA: pretty printing for struct expressions and tuple calls ) - #150698 (Improve comment clarity in candidate_may_shadow) - #150706 (Update wasm-component-ld) r? `@ghost` `@rustbot` modify labels: rollup
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jan 6, 2026
MGCA: pretty printing for struct expressions and tuple calls
not sure
1. if there any tests that i need to adjust
2. if i should add any test for it
3. if humanity has come up with anything better than checking if that's first iteration or not with flag when printing sequences with separator
in case there is no tests for it and i dont have to add any, there is a demonstration of this ✨ pretty ✨ printing (this is output from `-Z unpretty=hir`)
```
fn test_errors<const N:
usize>() {
// accepts_enum::<{ None::<u32> }>();
accepts_point::<Point1 { a: N, b: N }>();
accepts_point::<Point(N, N)>();
}
```
btw it does not print const block
for this
```
accepts_point::<{ Point1 { a: const {N + 1}, b: N } }>();
```
it will print
```
accepts_point::<Point1 { a: { N + 1 }, b: N }>();
```
not sure if we want to print const blocks or not
r? BoxyUwU
bors
added a commit
that referenced
this pull request
Jan 6, 2026
…uwer Rollup of 11 pull requests Successful merges: - #144113 (Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items) - #148339 (naked functions: emit `.private_extern` on macos) - #149880 (rustc_codegen_llvm: update alignment for double on AIX) - #150122 (Refactor function names of `rustc_ast_lowering`) - #150412 (use PIDFD_GET_INFO ioctl when available) - #150670 (THIR pattern building: Move all `thir::Pat` creation into `rustc_mir_build::thir::pattern`) - #150695 (MGCA: pretty printing for struct expressions and tuple calls ) - #150698 (Improve comment clarity in candidate_may_shadow) - #150706 (Update wasm-component-ld) - #150707 (Fix ICE when transmute Assume field is invalid) - #150708 (Enable merge queue in new bors) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
that referenced
this pull request
Jan 6, 2026
Rollup of 11 pull requests Successful merges: - #144113 (Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items) - #148339 (naked functions: emit `.private_extern` on macos) - #149880 (rustc_codegen_llvm: update alignment for double on AIX) - #150122 (Refactor function names of `rustc_ast_lowering`) - #150412 (use PIDFD_GET_INFO ioctl when available) - #150670 (THIR pattern building: Move all `thir::Pat` creation into `rustc_mir_build::thir::pattern`) - #150695 (MGCA: pretty printing for struct expressions and tuple calls ) - #150698 (Improve comment clarity in candidate_may_shadow) - #150706 (Update wasm-component-ld) - #150707 (Fix ICE when transmute Assume field is invalid) - #150708 (Enable merge queue in new bors) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
that referenced
this pull request
Jan 6, 2026
…uwer Rollup of 10 pull requests Successful merges: - #144113 (Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items) - #149880 (rustc_codegen_llvm: update alignment for double on AIX) - #150122 (Refactor function names of `rustc_ast_lowering`) - #150412 (use PIDFD_GET_INFO ioctl when available) - #150670 (THIR pattern building: Move all `thir::Pat` creation into `rustc_mir_build::thir::pattern`) - #150695 (MGCA: pretty printing for struct expressions and tuple calls ) - #150698 (Improve comment clarity in candidate_may_shadow) - #150706 (Update wasm-component-ld) - #150707 (Fix ICE when transmute Assume field is invalid) - #150708 (Enable merge queue in new bors) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Jan 6, 2026
Rollup merge of #150695 - Kivooeo:pretty-printing, r=BoxyUwU MGCA: pretty printing for struct expressions and tuple calls not sure 1. if there any tests that i need to adjust 2. if i should add any test for it 3. if humanity has come up with anything better than checking if that's first iteration or not with flag when printing sequences with separator in case there is no tests for it and i dont have to add any, there is a demonstration of this ✨ pretty ✨ printing (this is output from `-Z unpretty=hir`) ``` fn test_errors<const N: usize>() { // accepts_enum::<{ None::<u32> }>(); accepts_point::<Point1 { a: N, b: N }>(); accepts_point::<Point(N, N)>(); } ``` btw it does not print const block for this ``` accepts_point::<{ Point1 { a: const {N + 1}, b: N } }>(); ``` it will print ``` accepts_point::<Point1 { a: { N + 1 }, b: N }>(); ``` not sure if we want to print const blocks or not r? BoxyUwU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
not sure
in case there is no tests for it and i dont have to add any, there is a demonstration of this ✨ pretty ✨ printing (this is output from
-Z unpretty=hir)btw it does not print const block
for this
it will print
not sure if we want to print const blocks or not
r? BoxyUwU