diff options
| author | bors <bors@rust-lang.org> | 2024-02-29 16:10:05 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-02-29 16:10:05 +0000 |
| commit | 1a1876c9790f168fb51afa335a7ba3e6fc267d75 (patch) | |
| tree | 3bd55c979127cf371e5059d7debb7e9e8677c160 /compiler/rustc_pattern_analysis/src/lib.rs | |
| parent | 384d26fc7e3bdd7687cc17b2662b091f6017ec2a (diff) | |
| parent | 0e9f02d6fa769f1e96fc5e54af7b77b101bcc603 (diff) | |
| download | rust-1a1876c9790f168fb51afa335a7ba3e6fc267d75.tar.gz rust-1a1876c9790f168fb51afa335a7ba3e6fc267d75.zip | |
Auto merge of #121804 - GuillaumeGomez:rollup-jh0v3ex, r=GuillaumeGomez
Rollup of 7 pull requests Successful merges: - #119748 (Increase visibility of `join_path` and `split_paths`) - #120820 (Enable CMPXCHG16B, SSE3, SAHF/LAHF and 128-bit Atomics (in nightly) in Windows x64) - #121000 (pattern_analysis: rework how we hide empty private fields) - #121376 (Skip unnecessary comparison with half-open range patterns) - #121596 (Use volatile access instead of `#[used]` for `on_tls_callback`) - #121669 (Count stashed errors again) - #121783 (Emitter cleanups) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/lib.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/lib.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs index 164dc36b679..d4b38d260e7 100644 --- a/compiler/rustc_pattern_analysis/src/lib.rs +++ b/compiler/rustc_pattern_analysis/src/lib.rs @@ -82,6 +82,11 @@ use crate::usefulness::{compute_match_usefulness, ValidityConstraint}; pub trait Captures<'a> {} impl<'a, T: ?Sized> Captures<'a> for T {} +/// `bool` newtype that indicates whether this is a privately uninhabited field that we should skip +/// during analysis. +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub struct PrivateUninhabitedField(pub bool); + /// Context that provides type information about constructors. /// /// Most of the crate is parameterized on a type that implements this trait. @@ -105,13 +110,12 @@ pub trait TypeCx: Sized + fmt::Debug { /// The number of fields for this constructor. fn ctor_arity(&self, ctor: &Constructor<Self>, ty: &Self::Ty) -> usize; - /// The types of the fields for this constructor. The result must have a length of - /// `ctor_arity()`. + /// The types of the fields for this constructor. The result must contain `ctor_arity()` fields. fn ctor_sub_tys<'a>( &'a self, ctor: &'a Constructor<Self>, ty: &'a Self::Ty, - ) -> impl Iterator<Item = Self::Ty> + ExactSizeIterator + Captures<'a>; + ) -> impl Iterator<Item = (Self::Ty, PrivateUninhabitedField)> + ExactSizeIterator + Captures<'a>; /// The set of all the constructors for `ty`. /// |
