Struct rustc_middle::middle::region::FirstStatementIndex
source · pub struct FirstStatementIndex {
private: u32,
}
Expand description
Represents a subscope of block
for a binding that is introduced
by block.stmts[first_statement_index]
. Such subscopes represent
a suffix of the block. Note that each subscope does not include
the initializer expression, if any, for the statement indexed by
first_statement_index
.
For example, given { let (a, b) = EXPR_1; let c = EXPR_2; ... }
:
-
The subscope with
first_statement_index == 0
is scope of botha
andb
; it does not include EXPR_1, but does include everything after that firstlet
. (If you want a scope that includes EXPR_1 as well, then do not useScope::Remainder
, but instead anotherScope
that encompasses the whole block, e.g.,Scope::Node
. -
The subscope with
first_statement_index == 1
is scope ofc
, and thus does not include EXPR_2, but covers the...
.
Fields§
§private: u32
Implementations§
source§impl FirstStatementIndex
impl FirstStatementIndex
sourcepub const MAX_AS_U32: u32 = 4_294_967_040u32
pub const MAX_AS_U32: u32 = 4_294_967_040u32
Maximum value the index can take, as a u32
.
sourcepub const fn from_usize(value: usize) -> Self
pub const fn from_usize(value: usize) -> Self
sourcepub const unsafe fn from_u32_unchecked(value: u32) -> Self
pub const unsafe fn from_u32_unchecked(value: u32) -> Self
Creates a new index from a given u32
.
Safety
The provided value must be less than or equal to the maximum value for the newtype. Providing a value outside this range is undefined due to layout restrictions.
Prefer using from_u32
.
Trait Implementations§
source§impl Add<usize> for FirstStatementIndex
impl Add<usize> for FirstStatementIndex
source§impl Clone for FirstStatementIndex
impl Clone for FirstStatementIndex
source§fn clone(&self) -> FirstStatementIndex
fn clone(&self) -> FirstStatementIndex
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FirstStatementIndex
impl Debug for FirstStatementIndex
source§impl From<FirstStatementIndex> for u32
impl From<FirstStatementIndex> for u32
source§fn from(v: FirstStatementIndex) -> u32
fn from(v: FirstStatementIndex) -> u32
source§impl From<FirstStatementIndex> for usize
impl From<FirstStatementIndex> for usize
source§fn from(v: FirstStatementIndex) -> usize
fn from(v: FirstStatementIndex) -> usize
source§impl From<u32> for FirstStatementIndex
impl From<u32> for FirstStatementIndex
source§impl From<usize> for FirstStatementIndex
impl From<usize> for FirstStatementIndex
source§impl Hash for FirstStatementIndex
impl Hash for FirstStatementIndex
source§impl<'__ctx> HashStable<StableHashingContext<'__ctx>> for FirstStatementIndex
impl<'__ctx> HashStable<StableHashingContext<'__ctx>> for FirstStatementIndex
fn hash_stable(
&self,
__hcx: &mut StableHashingContext<'__ctx>,
__hasher: &mut StableHasher
)
source§impl Idx for FirstStatementIndex
impl Idx for FirstStatementIndex
source§impl Ord for FirstStatementIndex
impl Ord for FirstStatementIndex
source§fn cmp(&self, other: &FirstStatementIndex) -> Ordering
fn cmp(&self, other: &FirstStatementIndex) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<FirstStatementIndex> for FirstStatementIndex
impl PartialEq<FirstStatementIndex> for FirstStatementIndex
source§fn eq(&self, other: &FirstStatementIndex) -> bool
fn eq(&self, other: &FirstStatementIndex) -> bool
source§impl PartialOrd<FirstStatementIndex> for FirstStatementIndex
impl PartialOrd<FirstStatementIndex> for FirstStatementIndex
source§fn partial_cmp(&self, other: &FirstStatementIndex) -> Option<Ordering>
fn partial_cmp(&self, other: &FirstStatementIndex) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Step for FirstStatementIndex
impl Step for FirstStatementIndex
source§fn steps_between(start: &Self, end: &Self) -> Option<usize>
fn steps_between(start: &Self, end: &Self) -> Option<usize>
step_trait
)source§fn forward_checked(start: Self, u: usize) -> Option<Self>
fn forward_checked(start: Self, u: usize) -> Option<Self>
step_trait
)source§fn backward_checked(start: Self, u: usize) -> Option<Self>
fn backward_checked(start: Self, u: usize) -> Option<Self>
step_trait
)source§fn forward(start: Self, count: usize) -> Self
fn forward(start: Self, count: usize) -> Self
step_trait
)source§unsafe fn forward_unchecked(start: Self, count: usize) -> Self
unsafe fn forward_unchecked(start: Self, count: usize) -> Self
step_trait
)source§fn backward(start: Self, count: usize) -> Self
fn backward(start: Self, count: usize) -> Self
step_trait
)source§unsafe fn backward_unchecked(start: Self, count: usize) -> Self
unsafe fn backward_unchecked(start: Self, count: usize) -> Self
step_trait
)impl Copy for FirstStatementIndex
impl Eq for FirstStatementIndex
impl StructuralEq for FirstStatementIndex
impl StructuralPartialEq for FirstStatementIndex
impl TrustedStep for FirstStatementIndex
Auto Trait Implementations§
impl RefUnwindSafe for FirstStatementIndex
impl Send for FirstStatementIndex
impl Sync for FirstStatementIndex
impl Unpin for FirstStatementIndex
impl UnwindSafe for FirstStatementIndex
Blanket Implementations§
source§impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut T
fn allocate_from_iter<'a>(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = T>
) -> &'a mut [T] ⓘ
source§impl<Tcx, T> DepNodeParams<Tcx> for Twhere
Tcx: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
impl<Tcx, T> DepNodeParams<Tcx> for Twhere
Tcx: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
default fn fingerprint_style() -> FingerprintStyle
source§default fn to_fingerprint(&self, tcx: Tcx) -> Fingerprint
default fn to_fingerprint(&self, tcx: Tcx) -> Fingerprint
default fn to_debug_str(&self, _: Tcx) -> String
source§default fn recover(
_: Tcx,
_: &DepNode<<Tcx as DepContext>::DepKind>
) -> Option<T>
default fn recover(
_: Tcx,
_: &DepNode<<Tcx as DepContext>::DepKind>
) -> Option<T>
DepNode
,
something which is needed when forcing DepNode
s during red-green
evaluation. The query system will only call this method if
fingerprint_style()
is not FingerprintStyle::Opaque
.
It is always valid to return None
here, in which case incremental
compilation will treat the query as having changed instead of forcing it. Read moresource§impl<T, R> InternIteratorElement<T, R> for T
impl<T, R> InternIteratorElement<T, R> for T
type Output = R
fn intern_with<I, F>(iter: I, f: F) -> <T as InternIteratorElement<T, R>>::Outputwhere
I: Iterator<Item = T>,
F: FnOnce(&[T]) -> R,
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
source§impl<'tcx, T> ToPredicate<'tcx, T> for T
impl<'tcx, T> ToPredicate<'tcx, T> for T
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error(tcx: Tcx, _: &[QueryInfo]) -> T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. 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: 4 bytes