Struct rustc_mir_build::thir::pattern::deconstruct_pat::IntRange [−][src]
pub(super) struct IntRange {
range: RangeInclusive<u128>,
}Expand description
An inclusive interval, used for precise integer exhaustiveness checking.
IntRanges always store a contiguous range. This means that values are
encoded such that 0 encodes the minimum value for the integer,
regardless of the signedness.
For example, the pattern -128..=127i8 is encoded as 0..=255.
This makes comparisons and arithmetic on interval endpoints much more
straightforward. See signed_bias for details.
IntRange is never used to encode an empty range or a “range” that wraps
around the (offset) space: i.e., range.lo <= range.hi.
Fields
range: RangeInclusive<u128>Implementations
fn from_const<'tcx>(
tcx: TyCtxt<'tcx>,
param_env: ParamEnv<'tcx>,
value: &Const<'tcx>
) -> Option<IntRange>fn from_range<'tcx>(
tcx: TyCtxt<'tcx>,
lo: u128,
hi: u128,
ty: Ty<'tcx>,
end: &RangeEnd
) -> Option<IntRange>pub(super) fn lint_overlapping_range_endpoints<'a, 'tcx: 'a>(
&self,
pcx: PatCtxt<'_, '_, 'tcx>,
ctors: impl Iterator<Item = (&'a Constructor<'tcx>, Span)>,
column_count: usize,
hir_id: HirId
)
pub(super) fn lint_overlapping_range_endpoints<'a, 'tcx: 'a>(
&self,
pcx: PatCtxt<'_, '_, 'tcx>,
ctors: impl Iterator<Item = (&'a Constructor<'tcx>, Span)>,
column_count: usize,
hir_id: HirId
)Lint on likely incorrect range patterns (#63987)
See Constructor::is_covered_by
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for IntRangeimpl UnwindSafe for IntRangeBlanket Implementations
Mutably borrows from an owned value. Read more
Layout
Note: Most layout information is completely unstable and may be different between compiler versions and platforms. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 40 bytes