Skip to main content

Held

Struct Held 

Source
struct Held {
    srcs: HashMap<Root, Src>,
    origin: HashMap<Root, DefId>,
    selves: HashSet<Local>,
    nested: bool,
    coroutine: bool,
}
Expand description

What the values of one body hold, as Srcs.

In a function, Param(k) is its parameter k. In a closure or coroutine, it is the captured value k, which is what the body that creates it passes (Analyzer::local records the captures as the edge’s sources); its own parameters (the closure or Pin<&mut Self>, the context, a closure’s arguments) are unknown.

A parameter or capture is followed only if it is never assigned or borrowed mutably. A local or slot is followed only if it is assigned once, from a copy, move or shared borrow of a followed value (through *), a string constant, or a SAME_VALUE call of the standard library on one. Everything else is Unknown.

Fields§

§srcs: HashMap<Root, Src>§origin: HashMap<Root, DefId>

The local function whose call produced the value (a future returned by an async fn), followed through moves, borrows, into_future and Pin::new_unchecked.

§selves: HashSet<Local>

Locals that hold the closure or coroutine itself (_7 = copy (_1.0) of Pin<&mut _>).

§nested: bool§coroutine: bool

Implementations§

Source§

impl Held

Source

fn new<'tcx>( tcx: TyCtxt<'tcx>, def_id: DefId, body: &Body<'tcx>, constant: impl Fn(&Operand<'tcx>) -> Option<String>, ) -> Self

Source

fn root(&self, p: &Place<'_>) -> Option<Root>

The root a place’s value is read from: a local through *, a capture or a slot of the coroutine through *. None for anything else (a field of a local, an index).

Source

fn target_root(&self, p: &Place<'_>) -> Option<Root>

The root an assignment to p defines (a whole local or slot) or changes (a capture).

Source

fn base(&self, p: &Place<'_>) -> Root

The root whose value a write to p may change: its capture or slot, or its local.

Source

fn origin_of(&self, op: &Operand<'_>) -> Option<DefId>

The local function whose call produced an operand’s value, if one did.

Source

fn of<'tcx>( &self, op: &Operand<'tcx>, constant: impl Fn(&Operand<'tcx>) -> Option<String>, ) -> Src

What an operand of this body holds.

Auto Trait Implementations§

§

impl DynSend for Held

§

impl DynSync for Held

§

impl Forget for Held

§

impl Freeze for Held

§

impl Move for Held

§

impl RefUnwindSafe for Held

§

impl Send for Held

§

impl Sync for Held

§

impl Unpin for Held

§

impl UnsafeUnpin for Held

§

impl UnwindSafe for Held

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.