diff options
| author | Jubilee <46493976+workingjubilee@users.noreply.github.com> | 2024-07-21 17:44:30 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-21 17:44:30 -0700 |
| commit | d484654a5ec3ade413205ec03e403fccae4937dc (patch) | |
| tree | c8353631fb11103c1b1f7ed3975e401c955d9cf4 /compiler/rustc_pattern_analysis | |
| parent | b9c9f07db0705b9686a0b8a0aec03c887577211a (diff) | |
| parent | 8a49d83db730f3dfdd7f0c04df823549bf571b33 (diff) | |
| download | rust-d484654a5ec3ade413205ec03e403fccae4937dc.tar.gz rust-d484654a5ec3ade413205ec03e403fccae4937dc.zip | |
Rollup merge of #128033 - Nadrieril:explain-empty-wildcards, r=compiler-errors
Explain why we require `_` for empty patterns This adds a note to the "non-exhaustive patterns" diagnostic to explain why we sometimes require extra `_` patterns on empty types. This is one of the two diagnostic improvements I wanted to do before [stabilizing `min_exhaustive_patterns`](https://github.com/rust-lang/rust/pull/122792). r? ``@compiler-errors``
Diffstat (limited to 'compiler/rustc_pattern_analysis')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/rustc.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_pattern_analysis/src/rustc.rs b/compiler/rustc_pattern_analysis/src/rustc.rs index d17ee8bff50..6ef2d69273e 100644 --- a/compiler/rustc_pattern_analysis/src/rustc.rs +++ b/compiler/rustc_pattern_analysis/src/rustc.rs @@ -40,9 +40,15 @@ pub type WitnessPat<'p, 'tcx> = crate::pat::WitnessPat<RustcPatCtxt<'p, 'tcx>>; /// /// Use `.inner()` or deref to get to the `Ty<'tcx>`. #[repr(transparent)] -#[derive(Clone, Copy)] +#[derive(Clone, Copy, PartialEq, Eq, Hash)] pub struct RevealedTy<'tcx>(Ty<'tcx>); +impl<'tcx> fmt::Display for RevealedTy<'tcx> { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0.fmt(fmt) + } +} + impl<'tcx> fmt::Debug for RevealedTy<'tcx> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.fmt(fmt) |
