diff options
| author | Nadrieril <nadrieril+git@gmail.com> | 2024-01-24 20:04:33 +0100 |
|---|---|---|
| committer | Nadrieril <nadrieril+git@gmail.com> | 2024-01-24 20:04:33 +0100 |
| commit | bdab21399372bee9127b5e6641c8a54034005138 (patch) | |
| tree | 524c364e1cf57836e1e513dd9420c52e9396b2fe /compiler/rustc_pattern_analysis/src/lib.rs | |
| parent | cd6d8f2a04528f827ad3d399581c0f3502b15a72 (diff) | |
| download | rust-bdab21399372bee9127b5e6641c8a54034005138.tar.gz rust-bdab21399372bee9127b5e6641c8a54034005138.zip | |
Most of the `DeconstructedPat` `Debug` impl is reusable
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/lib.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/lib.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs index 4fd01b5e638..51784903178 100644 --- a/compiler/rustc_pattern_analysis/src/lib.rs +++ b/compiler/rustc_pattern_analysis/src/lib.rs @@ -108,8 +108,12 @@ pub trait TypeCx: Sized + fmt::Debug { /// This must follow the invariants of `ConstructorSet` fn ctors_for_ty(&self, ty: &Self::Ty) -> Result<ConstructorSet<Self>, Self::Error>; - /// Best-effort `Debug` implementation. - fn debug_pat(f: &mut fmt::Formatter<'_>, pat: &DeconstructedPat<'_, Self>) -> fmt::Result; + /// Write the name of the variant represented by `pat`. Used for the best-effort `Debug` impl of + /// `DeconstructedPat`. Only invoqued when `pat.ctor()` is `Struct | Variant(_) | UnionField`. + fn write_variant_name( + f: &mut fmt::Formatter<'_>, + pat: &crate::pat::DeconstructedPat<'_, Self>, + ) -> fmt::Result; /// Raise a bug. fn bug(&self, fmt: fmt::Arguments<'_>) -> !; |
