[−][src]Enum rustc_middle::mir::Operand
These are values that can appear inside an rvalue. They are intentionally limited to prevent rvalues from being nested in one another.
Variants
Copy(Place<'tcx>)Copy: The value must be available for use afterwards.
This implies that the type of the place must be Copy; this is true
by construction during build, but also checked by the MIR type checker.
Move(Place<'tcx>)Move: The value (including old borrows of it) will not be used again.
Safe for values of all types (modulo future developments towards ?Move).
Correct usage patterns are enforced by the borrow checker for safe code.
Copy may be converted to Move to enable "last-use" optimizations.
Synthesizes a constant value.
Implementations
impl<'tcx> Operand<'tcx>[src]
pub fn ty<D>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> Ty<'tcx> where
D: HasLocalDecls<'tcx>, [src]
D: HasLocalDecls<'tcx>,
impl<'tcx> Operand<'tcx>[src]
pub fn function_handle(
tcx: TyCtxt<'tcx>,
def_id: DefId,
substs: SubstsRef<'tcx>,
span: Span
) -> Self[src]
tcx: TyCtxt<'tcx>,
def_id: DefId,
substs: SubstsRef<'tcx>,
span: Span
) -> Self
Convenience helper to make a constant that refers to the fn
with given DefId and substs. Since this is used to synthesize
MIR, assumes user_ty is None.
pub fn const_from_scalar(
tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>,
val: Scalar,
span: Span
) -> Operand<'tcx>[src]
tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>,
val: Scalar,
span: Span
) -> Operand<'tcx>
Convenience helper to make a literal-like constant from a given scalar value.
Since this is used to synthesize MIR, assumes user_ty is None.
pub fn scalar_from_const(operand: &Operand<'tcx>) -> Scalar[src]
Convenience helper to make a Scalar from the given Operand, assuming that Operand
wraps a constant literal value. Panics if this is not the case.
pub fn const_from_str(tcx: TyCtxt<'tcx>, val: &str, span: Span) -> Operand<'tcx>[src]
Convenience helper to make a literal-like constant from a given &str slice.
Since this is used to synthesize MIR, assumes user_ty is None.
pub fn value_from_const(operand: &Operand<'tcx>) -> ConstValue<'tcx>[src]
Convenience helper to make a ConstValue from the given Operand, assuming that Operand
wraps a constant value (such as a &str slice). Panics if this is not the case.
pub fn to_copy(&self) -> Self[src]
pub fn place(&self) -> Option<Place<'tcx>>[src]
Returns the Place that is the target of this Operand, or None if this Operand is a
constant.
Trait Implementations
impl<'tcx> Clone for Operand<'tcx>[src]
impl<'tcx> Debug for Operand<'tcx>[src]
impl<'tcx, __D: TyDecoder<'tcx>> Decodable<__D> for Operand<'tcx>[src]
impl<'tcx, __E: TyEncoder<'tcx>> Encodable<__E> for Operand<'tcx>[src]
impl<'tcx, '__ctx> HashStable<StableHashingContext<'__ctx>> for Operand<'tcx>[src]
fn hash_stable(
&self,
__hcx: &mut StableHashingContext<'__ctx>,
__hasher: &mut StableHasher
)[src]
&self,
__hcx: &mut StableHashingContext<'__ctx>,
__hasher: &mut StableHasher
)
impl<'tcx> PartialEq<Operand<'tcx>> for Operand<'tcx>[src]
impl<'tcx> StructuralPartialEq for Operand<'tcx>[src]
impl<'tcx> TypeFoldable<'tcx> for Operand<'tcx>[src]
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self[src]
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool[src]
fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self[src]
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool[src]
fn has_vars_bound_at_or_above(&self, binder: DebruijnIndex) -> bool[src]
fn has_vars_bound_above(&self, binder: DebruijnIndex) -> bool[src]
fn has_escaping_bound_vars(&self) -> bool[src]
fn has_type_flags(&self, flags: TypeFlags) -> bool[src]
fn has_projections(&self) -> bool[src]
fn has_opaque_types(&self) -> bool[src]
fn references_error(&self) -> bool[src]
fn has_param_types_or_consts(&self) -> bool[src]
fn has_infer_regions(&self) -> bool[src]
fn has_infer_types(&self) -> bool[src]
fn has_infer_types_or_consts(&self) -> bool[src]
fn has_infer_consts(&self) -> bool[src]
fn needs_infer(&self) -> bool[src]
fn has_placeholders(&self) -> bool[src]
fn needs_subst(&self) -> bool[src]
fn has_re_placeholders(&self) -> bool[src]
fn has_free_regions(&self) -> bool[src]
fn has_erased_regions(&self) -> bool[src]
fn has_erasable_regions(&self) -> bool[src]
fn is_global(&self) -> bool[src]
fn has_late_bound_regions(&self) -> bool[src]
fn still_further_specializable(&self) -> bool[src]
fn visit_tys_shallow(&self, visit: impl FnMut(Ty<'tcx>) -> bool) -> bool[src]
Auto Trait Implementations
impl<'tcx> !RefUnwindSafe for Operand<'tcx>
impl<'tcx> !Send for Operand<'tcx>
impl<'tcx> !Sync for Operand<'tcx>
impl<'tcx> Unpin for Operand<'tcx>
impl<'tcx> !UnwindSafe for Operand<'tcx>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,
impl<Ctxt, T> DepNodeParams<Ctxt> for T where
Ctxt: DepContext,
T: HashStable<<Ctxt as DepContext>::StableHashingContext> + Debug, [src]
Ctxt: DepContext,
T: HashStable<<Ctxt as DepContext>::StableHashingContext> + Debug,
default fn can_reconstruct_query_key() -> bool[src]
default fn to_fingerprint(&self, tcx: Ctxt) -> Fingerprint[src]
default fn to_debug_str(&self, Ctxt) -> String[src]
default fn recover(Ctxt, &DepNode<<Ctxt as DepContext>::DepKind>) -> Option<T>[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> MaybeResult<T> for T[src]
type Error = !
fn from(Result<T, <T as MaybeResult<T>>::Error>) -> T[src]
fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>[src]
impl<'tcx, T> Subst<'tcx> for T where
T: TypeFoldable<'tcx>, [src]
T: TypeFoldable<'tcx>,
fn subst_spanned(&Self, TyCtxt<'tcx>, &[GenericArg<'tcx>], Option<Span>) -> T[src]
fn subst(&self, tcx: TyCtxt<'tcx>, substs: &[GenericArg<'tcx>]) -> Self[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.