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
sourceimpl 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
sourceimpl Add<usize> for FirstStatementIndex
impl Add<usize> for FirstStatementIndex
sourceimpl Clone for FirstStatementIndex
impl Clone for FirstStatementIndex
sourcefn clone(&self) -> FirstStatementIndex
fn clone(&self) -> FirstStatementIndex
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for FirstStatementIndex
impl Debug for FirstStatementIndex
sourceimpl From<FirstStatementIndex> for u32
impl From<FirstStatementIndex> for u32
sourcefn from(v: FirstStatementIndex) -> u32
fn from(v: FirstStatementIndex) -> u32
sourceimpl From<FirstStatementIndex> for usize
impl From<FirstStatementIndex> for usize
sourcefn from(v: FirstStatementIndex) -> usize
fn from(v: FirstStatementIndex) -> usize
sourceimpl From<u32> for FirstStatementIndex
impl From<u32> for FirstStatementIndex
sourceimpl From<usize> for FirstStatementIndex
impl From<usize> for FirstStatementIndex
sourceimpl Hash for FirstStatementIndex
impl Hash for FirstStatementIndex
sourceimpl<'__ctx> HashStable<StableHashingContext<'__ctx>> for FirstStatementIndex
impl<'__ctx> HashStable<StableHashingContext<'__ctx>> for FirstStatementIndex
fn hash_stable(
&self,
__hcx: &mut StableHashingContext<'__ctx>,
__hasher: &mut StableHasher
)
sourceimpl Idx for FirstStatementIndex
impl Idx for FirstStatementIndex
sourceimpl Ord for FirstStatementIndex
impl Ord for FirstStatementIndex
sourcefn cmp(&self, other: &FirstStatementIndex) -> Ordering
fn cmp(&self, other: &FirstStatementIndex) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialEq<FirstStatementIndex> for FirstStatementIndex
impl PartialEq<FirstStatementIndex> for FirstStatementIndex
sourcefn eq(&self, other: &FirstStatementIndex) -> bool
fn eq(&self, other: &FirstStatementIndex) -> bool
sourceimpl PartialOrd<FirstStatementIndex> for FirstStatementIndex
impl PartialOrd<FirstStatementIndex> for FirstStatementIndex
sourcefn partial_cmp(&self, other: &FirstStatementIndex) -> Option<Ordering>
fn partial_cmp(&self, other: &FirstStatementIndex) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresourceimpl Step for FirstStatementIndex
impl Step for FirstStatementIndex
sourcefn steps_between(start: &Self, end: &Self) -> Option<usize>
fn steps_between(start: &Self, end: &Self) -> Option<usize>
step_trait
)sourcefn forward_checked(start: Self, u: usize) -> Option<Self>
fn forward_checked(start: Self, u: usize) -> Option<Self>
step_trait
)sourcefn backward_checked(start: Self, u: usize) -> Option<Self>
fn backward_checked(start: Self, u: usize) -> Option<Self>
step_trait
)sourcefn forward(start: Self, count: usize) -> Self
fn forward(start: Self, count: usize) -> Self
step_trait
)sourceunsafe fn forward_unchecked(start: Self, count: usize) -> Self
unsafe fn forward_unchecked(start: Self, count: usize) -> Self
step_trait
)sourcefn backward(start: Self, count: usize) -> Self
fn backward(start: Self, count: usize) -> Self
step_trait
)sourceunsafe 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
sourceimpl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on(self, arena: &'a Arena<'tcx>) -> &'a mut T
fn allocate_from_iter(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = T>
) -> &'a mut [T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Ctxt, T> DepNodeParams<Ctxt> for Twhere
Ctxt: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
impl<Ctxt, T> DepNodeParams<Ctxt> for Twhere
Ctxt: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
default fn fingerprint_style() -> FingerprintStyle
sourcedefault fn to_fingerprint(&self, tcx: Ctxt) -> Fingerprint
default fn to_fingerprint(&self, tcx: Ctxt) -> Fingerprint
default fn to_debug_str(&self, Ctxt) -> String
sourcedefault fn recover(Ctxt, &DepNode<<Ctxt as DepContext>::DepKind>) -> Option<T>
default fn recover(Ctxt, &DepNode<<Ctxt 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 moresourceimpl<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,
sourceimpl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
sourceimpl<CTX, T> Value<CTX> for Twhere
CTX: DepContext,
impl<CTX, T> Value<CTX> for Twhere
CTX: DepContext,
default fn from_cycle_error(tcx: CTX) -> T
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
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