rust/compiler/rustc_attr_data_structures/src
Jakub Beránek c054bac89a
Rollup merge of #138063 - compiler-errors:improve-attr-unpretty, r=jdonszelmann
Improve `-Zunpretty=hir` for parsed attrs

0. Rename `print_something` to `should_render` to make it distinct from `print_attribute` in that it doesn't print anything, it's just a way to probe if a type renders anything.
1. Fixes a few bugs in the `PrintAttribute` derive. Namely, the `__printed_anything` variable was entangled with the `should_render` call, leading us to always render field names but never render commas.
2. Remove the outermost `""` from the attr.
3. Debug print `Symbol`s. I know that this is redundant for some parsed attributes, but there's no good way to distinguish symbols that are ident-like and symbols which are cooked string literals. We could perhaps *conditionally* to fall back to a debug printing if the symbol doesn't match an ident? But seems like overkill.

Based on #138060, only review the commits not in that one.
2025-03-11 13:30:51 +01:00
..
attributes.rs Spruce up AttributeKind docs 2025-02-26 22:21:36 +00:00
lib.rs Rollup merge of #138063 - compiler-errors:improve-attr-unpretty, r=jdonszelmann 2025-03-11 13:30:51 +01:00
stability.rs pretty print hir attributes 2025-02-24 14:31:19 +01:00
version.rs pretty print hir attributes 2025-02-24 14:31:19 +01:00