Struct rustc_const_eval::interpret::eval_context::LocalState
source · [−]pub struct LocalState<'tcx, Tag: Provenance = AllocId> {
pub value: LocalValue<Tag>,
pub layout: Cell<Option<TyAndLayout<'tcx>>>,
}Expand description
State of a local variable including a memoized layout
Fields
value: LocalValue<Tag>layout: Cell<Option<TyAndLayout<'tcx>>>Don’t modify if Some, this is only used to prevent computing the layout twice
Implementations
sourceimpl<'tcx, Tag: Provenance + 'static> LocalState<'tcx, Tag>
impl<'tcx, Tag: Provenance + 'static> LocalState<'tcx, Tag>
sourcepub fn access(&self) -> InterpResult<'tcx, Operand<Tag>>
pub fn access(&self) -> InterpResult<'tcx, Operand<Tag>>
Read the local’s value or error if the local is not yet live or not live anymore.
Note: This may only be invoked from the Machine::access_local hook and not from
anywhere else. You may be invalidating machine invariants if you do!
sourcepub fn access_mut(
&mut self
) -> InterpResult<'tcx, Result<&mut LocalValue<Tag>, MemPlace<Tag>>>
pub fn access_mut(
&mut self
) -> InterpResult<'tcx, Result<&mut LocalValue<Tag>, MemPlace<Tag>>>
Overwrite the local. If the local can be overwritten in place, return a reference
to do so; otherwise return the MemPlace to consult instead.
Note: This may only be invoked from the Machine::access_local_mut hook and not from
anywhere else. You may be invalidating machine invariants if you do!
Trait Implementations
sourceimpl<'tcx, Tag: Clone + Provenance> Clone for LocalState<'tcx, Tag>
impl<'tcx, Tag: Clone + Provenance> Clone for LocalState<'tcx, Tag>
sourcefn clone(&self) -> LocalState<'tcx, Tag>
fn clone(&self) -> LocalState<'tcx, Tag>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<'tcx, '__ctx, Tag: Provenance> HashStable<StableHashingContext<'__ctx>> for LocalState<'tcx, Tag> where
Tag: HashStable<StableHashingContext<'__ctx>>,
impl<'tcx, '__ctx, Tag: Provenance> HashStable<StableHashingContext<'__ctx>> for LocalState<'tcx, Tag> where
Tag: HashStable<StableHashingContext<'__ctx>>,
fn hash_stable(
&self,
__hcx: &mut StableHashingContext<'__ctx>,
__hasher: &mut StableHasher
)
sourceimpl<'tcx, Tag: PartialEq + Provenance> PartialEq<LocalState<'tcx, Tag>> for LocalState<'tcx, Tag>
impl<'tcx, Tag: PartialEq + Provenance> PartialEq<LocalState<'tcx, Tag>> for LocalState<'tcx, Tag>
sourcefn eq(&self, other: &LocalState<'tcx, Tag>) -> bool
fn eq(&self, other: &LocalState<'tcx, Tag>) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &LocalState<'tcx, Tag>) -> bool
fn ne(&self, other: &LocalState<'tcx, Tag>) -> bool
This method tests for !=.
impl<'tcx, Tag: Eq + Provenance> Eq for LocalState<'tcx, Tag>
impl<'tcx, Tag: Provenance> StructuralEq for LocalState<'tcx, Tag>
impl<'tcx, Tag: Provenance> StructuralPartialEq for LocalState<'tcx, Tag>
Auto Trait Implementations
impl<'tcx, Tag = AllocId> !RefUnwindSafe for LocalState<'tcx, Tag>
impl<'tcx, Tag> Send for LocalState<'tcx, Tag> where
Tag: Send,
impl<'tcx, Tag = AllocId> !Sync for LocalState<'tcx, Tag>
impl<'tcx, Tag> Unpin for LocalState<'tcx, Tag> where
Tag: Unpin,
impl<'tcx, Tag = AllocId> !UnwindSafe for LocalState<'tcx, Tag>
Blanket Implementations
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<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
Layout
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.