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 == 0is scope of bothaandb; 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 anotherScopethat encompasses the whole block, e.g.,Scope::Node. -
The subscope with
first_statement_index == 1is scope ofc, and thus does not include EXPR_2, but covers the....
Fields
private: u32Implementations
sourceimpl FirstStatementIndex
impl FirstStatementIndex
sourcepub const MAX_AS_U32: u32
pub const MAX_AS_U32: u32
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
sourceimpl Debug for FirstStatementIndex
impl Debug for FirstStatementIndex
sourceimpl<E: Encoder> Encodable<E> for FirstStatementIndex
impl<E: Encoder> Encodable<E> for FirstStatementIndex
sourceimpl From<FirstStatementIndex> for u32
impl From<FirstStatementIndex> for u32
sourcefn from(v: FirstStatementIndex) -> u32
fn from(v: FirstStatementIndex) -> u32
Performs the conversion.
sourceimpl From<FirstStatementIndex> for usize
impl From<FirstStatementIndex> for usize
sourcefn from(v: FirstStatementIndex) -> usize
fn from(v: FirstStatementIndex) -> usize
Performs the conversion.
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
sourceimpl PartialEq<FirstStatementIndex> for FirstStatementIndex
impl PartialEq<FirstStatementIndex> for FirstStatementIndex
sourcefn eq(&self, other: &FirstStatementIndex) -> bool
fn eq(&self, other: &FirstStatementIndex) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &FirstStatementIndex) -> bool
fn ne(&self, other: &FirstStatementIndex) -> bool
This method tests for !=.
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>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
sourceimpl 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)Returns the number of successor steps required to get from start to end. Read more
sourcefn forward_checked(start: Self, u: usize) -> Option<Self>
fn forward_checked(start: Self, u: usize) -> Option<Self>
step_trait)Returns the value that would be obtained by taking the successor
of self count times. Read more
sourcefn backward_checked(start: Self, u: usize) -> Option<Self>
fn backward_checked(start: Self, u: usize) -> Option<Self>
step_trait)Returns the value that would be obtained by taking the predecessor
of self count times. Read more
sourcefn forward(start: Self, count: usize) -> Self
fn forward(start: Self, count: usize) -> Self
step_trait)Returns the value that would be obtained by taking the successor
of self count times. Read more
sourceunsafe fn forward_unchecked(start: Self, count: usize) -> Self
unsafe fn forward_unchecked(start: Self, count: usize) -> Self
step_trait)Returns the value that would be obtained by taking the successor
of self count times. Read more
sourcefn backward(start: Self, count: usize) -> Self
fn backward(start: Self, count: usize) -> Self
step_trait)Returns the value that would be obtained by taking the predecessor
of self count times. Read more
sourceunsafe fn backward_unchecked(start: Self, count: usize) -> Self
unsafe fn backward_unchecked(start: Self, count: usize) -> Self
step_trait)Returns the value that would be obtained by taking the predecessor
of self count times. Read more
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 T where
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for T where
T: Copy,
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self
fn allocate_from_iter<'a>(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = Self>
) -> &'a mut [Self]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Ctxt, T> DepNodeParams<Ctxt> for T where
Ctxt: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
impl<Ctxt, T> DepNodeParams<Ctxt> for T where
Ctxt: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
pub default fn fingerprint_style() -> FingerprintStyle
sourcepub default fn to_fingerprint(&self, tcx: Ctxt) -> Fingerprint
pub default fn to_fingerprint(&self, tcx: Ctxt) -> Fingerprint
This method turns the parameters of a DepNodeConstructor into an opaque Fingerprint to be used in DepNode. Not all DepNodeParams support being turned into a Fingerprint (they don’t need to if the corresponding DepNode is anonymous). Read more
pub default fn to_debug_str(&self, Ctxt) -> String
sourcepub default fn recover(
Ctxt,
&DepNode<<Ctxt as DepContext>::DepKind>
) -> Option<T>
pub default fn recover(
Ctxt,
&DepNode<<Ctxt as DepContext>::DepKind>
) -> Option<T>
This method tries to recover the query key from the given DepNode,
something which is needed when forcing DepNodes 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 more
sourceimpl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<'a, T> Captures<'a> for T where
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