[−][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 is_move(&self) -> bool[src]
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 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.
pub fn constant(&self) -> Option<&Constant<'tcx>>[src]
Returns the Constant that is the target of this Operand, or None if this Operand is a
place.
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]
pub 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]
pub fn eq(&self, other: &Operand<'tcx>) -> bool[src]
pub fn ne(&self, other: &Operand<'tcx>) -> bool[src]
impl<'tcx> StructuralPartialEq for Operand<'tcx>[src]
impl<'tcx> TypeFoldable<'tcx> for Operand<'tcx>[src]
pub fn super_fold_with<F: TypeFolder<'tcx>>(self, folder: &mut F) -> Self[src]
pub fn super_visit_with<V: TypeVisitor<'tcx>>(
&self,
visitor: &mut V
) -> ControlFlow<V::BreakTy>[src]
&self,
visitor: &mut V
) -> ControlFlow<V::BreakTy>
pub fn fold_with<F: TypeFolder<'tcx>>(self, folder: &mut F) -> Self[src]
pub fn visit_with<V: TypeVisitor<'tcx>>(
&self,
visitor: &mut V
) -> ControlFlow<V::BreakTy>[src]
&self,
visitor: &mut V
) -> ControlFlow<V::BreakTy>
pub fn has_vars_bound_at_or_above(&self, binder: DebruijnIndex) -> bool[src]
pub fn has_vars_bound_above(&self, binder: DebruijnIndex) -> bool[src]
pub fn has_escaping_bound_vars(&self) -> bool[src]
pub fn has_type_flags(&self, flags: TypeFlags) -> bool[src]
pub fn has_projections(&self) -> bool[src]
pub fn has_opaque_types(&self) -> bool[src]
pub fn references_error(&self) -> bool[src]
pub fn has_param_types_or_consts(&self) -> bool[src]
pub fn has_infer_regions(&self) -> bool[src]
pub fn has_infer_types(&self) -> bool[src]
pub fn has_infer_types_or_consts(&self) -> bool[src]
pub fn needs_infer(&self) -> bool[src]
pub fn has_placeholders(&self) -> bool[src]
pub fn needs_subst(&self) -> bool[src]
pub fn has_free_regions(&self) -> bool[src]
pub fn has_erased_regions(&self) -> bool[src]
pub fn has_erasable_regions(&self) -> bool[src]
pub fn is_global(&self) -> bool[src]
pub fn has_late_bound_regions(&self) -> bool[src]
pub fn still_further_specializable(&self) -> 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,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,
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 = !
pub fn from(Result<T, <T as MaybeResult<T>>::Error>) -> T[src]
pub 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>,
pub fn subst_spanned(Self, TyCtxt<'tcx>, &[GenericArg<'tcx>], Option<Span>) -> T[src]
pub 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.
pub fn to_owned(&self) -> T[src]
pub 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.
pub 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.