Commit Graph

22 Commits

Author SHA1 Message Date
dianne 8f649a7e58 clean up witness printing for tuple-like constructors
By construction, `subpatterns` contains all fields in order. Witness
patterns are constructed with all fields in order by
`WitnessPat::wild_from_ctor` and `WitnessStack::apply_constructor`, and
the order is preserved at `write_struct_like`'s call-site in
`print_witness_pat`. It's thus no longer necessary to go looking for
fields or handle missing fields.
2025-08-10 16:34:11 -07:00
dianne 9449b78621 show a trailing comma on singleton tuple constructors in witness pats 2025-08-10 15:32:14 -07:00
Jubilee Young 4839d6e6e5 compiler: Add rustc_abi dependence to the compiler
Depend on rustc_abi in compiler crates that use it indirectly but have
not yet taken on that dependency, and are not entangled in my other PRs.
This leaves an "excise rustc_target" step after the dust settles.
2024-10-27 21:10:58 -07:00
Zalathar fc55129774 Remove print::Pat entirely, replacing it with String 2024-08-11 20:25:03 +10:00
Zalathar bfe88a3bd0 Remove PatKind::Never 2024-08-11 19:57:30 +10:00
Zalathar ec1483bf2e Remove PatKind::Slice 2024-08-11 19:57:30 +10:00
Zalathar 2b6f4386eb Remove PatKind::Range 2024-08-11 19:57:30 +10:00
Zalathar 9952e4d4c8 Remove PatKind::Constant 2024-08-11 19:57:30 +10:00
Zalathar 283243ac5a Remove PatKind::Ref 2024-08-11 19:57:30 +10:00
Zalathar 15cc0e1b5c Remove PatKind::Box 2024-08-11 19:57:30 +10:00
Zalathar ed3e38f336 Remove PatKind::StructLike 2024-08-11 19:57:30 +10:00
Zalathar 92eb159d04 Remove PatKind::Wild 2024-08-11 19:57:30 +10:00
Zalathar f53eb2724d Add print::PatKind::Print
This will allow for the gradual removal of all other variants.
2024-08-11 19:57:30 +10:00
Zalathar 0a777090d8 Avoid matching on PatKind::Wild in write_struct_like 2024-08-11 19:57:30 +10:00
Zalathar 482412c98a Use TyCtxt::is_diagnostic_item 2024-08-07 21:44:53 +10:00
Zalathar 29245ec759 Avoid using ty::tls::with in write_struct_like 2024-08-07 21:44:53 +10:00
Zalathar a5ed6fb646 Split out hoisting/printing of box patterns 2024-08-07 20:52:47 +10:00
Zalathar e98e19e491 Replace an unnecessary slice pattern with has_dot_dot: bool 2024-08-07 20:52:46 +10:00
Zalathar 4cd800503f Remove an impossible case under EnumInfo::NotEnum 2024-08-07 20:52:46 +10:00
Zalathar 74f76ae5ea Unify Variant and Leaf into print::PatKind::StructLike 2024-08-07 20:52:46 +10:00
Zalathar ccfd94e334 Break up print::Pat printing into several helper functions 2024-08-07 20:52:46 +10:00
Zalathar dd5a8d7714 Use a separate pattern type for rustc_pattern_analysis diagnostics
The pattern-analysis code needs to print patterns, as part of its user-visible
diagnostics. But it never actually tries to print "real" patterns! Instead, it
only ever prints synthetic patterns that it has reconstructed from its own
internal represenations.

We can therefore simultaneously remove two obstacles to changing `thir::Pat`,
by having the pattern-analysis code use its own dedicated type for building
printable patterns, and then making `thir::Pat` not printable at all.
2024-07-31 16:03:27 +10:00