-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
MGCA: pretty printing for struct expressions and tuple calls #150695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to use self.commasep to do the comma delimited lists with handling of omitting the comma if its only one element.
compiler/rustc_hir_pretty/src/lib.rs
Outdated
|
|
||
| fn print_const_arg(&mut self, const_arg: &hir::ConstArg<'_>) { | ||
| match &const_arg.kind { | ||
| // FIXME(mgca): proper printing for struct exprs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove fixme :3
|
I think we probably do want to print const blocks 🤔 The best way to accomplish that is likely to change the printing for |
|
I think you can write a test for this by adding |
77f1280 to
1e11627
Compare
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 |
1e11627 to
85c8e41
Compare
|
thanks @bors r+ rollup |
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
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
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
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
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
…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
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
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
…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
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