pub struct UseSites { /* private fields */ }Expand description
Tracks use sites for each variable, indexed by variable arena index.
Implementations§
Source§impl UseSites
impl UseSites
Sourcepub fn analyze(lowered: &Lowered<'_>) -> Self
pub fn analyze(lowered: &Lowered<'_>) -> Self
Builds use-site information by scanning all statements and block ends.
Sourcepub fn use_count(&self, var: VariableId) -> usize
pub fn use_count(&self, var: VariableId) -> usize
Returns the total number of consuming slots remaining for var (the summed
multiplicity across all of its use-site locations).
Sourcepub fn move_uses(&mut self, from: VariableId, to: VariableId, loc: UseLocation)
pub fn move_uses(&mut self, from: VariableId, to: VariableId, loc: UseLocation)
Moves all uses of from at loc to to, mirroring a rename that rewrites
every consuming slot at that location in one go: the whole per-location count is
transferred and added to any uses to already has there. No-op if from has no
use at loc.
Sourcepub fn use_locs(
&self,
var: VariableId,
) -> impl ExactSizeIterator<Item = (UseLocation, usize)> + '_
pub fn use_locs( &self, var: VariableId, ) -> impl ExactSizeIterator<Item = (UseLocation, usize)> + '_
Returns each use-site location for var together with its multiplicity (the
number of consuming slots at that location).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UseSites
impl RefUnwindSafe for UseSites
impl Send for UseSites
impl Sync for UseSites
impl Unpin for UseSites
impl UnsafeUnpin for UseSites
impl UnwindSafe for UseSites
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<'db, T> DebugDbUpcast<'db, T> for Twhere
T: ?Sized,
impl<'db, T> DebugDbUpcast<'db, T> for Twhere
T: ?Sized,
fn debug_db_upcast(&'db self) -> &'db T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more