pub fn ref_to_mplace(
        &self, val: ValTy<'tcx>
    ) -> EvalResult<'tcx, MPlaceTy<'tcx>> {
        let pointee_type = val.layout.ty.builtin_deref(true).unwrap().ty;
        let layout = self.layout_of(pointee_type)?;
        let mplace = match self.tcx.struct_tail(pointee_type).sty {
            ty::Dynamic(..) => {
                let (ptr, vtable) = val.to_scalar_dyn_trait()?;
                MemPlace {
                    ptr,
                    align: layout.align,
                    extra: PlaceExtra::Vtable(vtable),
                }
            }
            ty::Str | ty::Slice(_) => {
                let (ptr, len) = val.to_scalar_slice(self)?;
                MemPlace {
                    ptr,
                    align: layout.align,
                    extra: PlaceExtra::Length(len),
                }
            }
            _ => MemPlace {
                ptr: val.to_scalar()?,
                align: layout.align,
                extra: PlaceExtra::None,
            },
        };
        Ok(MPlaceTy { mplace, layout })
    }
/// Take a value, which represents a (thin or fat) reference, and make it a place.
/// Alignment is just based on the type.  This is the inverse of `MemPlace::to_ref`.
Take a value, which represents a (thin or fat) reference, and make it a place.
Alignment is just based on the type.
Take a value which represents a ( thin or fat ) reference and make it a place . Alignment is just based on the type .
pub fn ref_to_mplace(
        &self, val: ValTy<'tcx>
    ) -> EvalResult<'tcx, MPlaceTy<'tcx>> {
        let pointee_type = val.layout.ty.builtin_deref(true).unwrap().ty;
        let layout = self.layout_of(pointee_type)?;
        let mplace = match self.tcx.struct_tail(pointee_type).sty {
            ty::Dynamic(..) => {
                let (ptr, vtable) = val.to_scalar_dyn_trait()?;
                MemPlace {
                    ptr,
                    align: layout.align,
                    extra: PlaceExtra::Vtable(vtable),
                }
            }
            ty::Str | ty::Slice(_) => {
                let (ptr, len) = val.to_scalar_slice(self)?;
                MemPlace {
                    ptr,
                    align: layout.align,
                    extra: PlaceExtra::Length(len),
                }
            }
            _ => MemPlace {
                ptr: val.to_scalar()?,
                align: layout.align,
                extra: PlaceExtra::None,
            },
        };
        Ok(MPlaceTy { mplace, layout })
    }
pub fn ref_to_mplace ( & self , val : ValTy < ' tcx > ) -> EvalResult < ' tcx , MPlaceTy < ' tcx > > { let pointee_type = val . layout . ty . builtin_deref ( true ) . unwrap ( ) . ty ; let layout = self . layout_of ( pointee_type ) ? ; let mplace = match self . tcx . struct_tail ( pointee_type ) . sty { ty :: Dynamic ( .. ) => { let ( ptr , vtable ) = val . to_scalar_dyn_trait ( ) ? ; MemPlace { ptr , align : layout . align , extra : PlaceExtra :: Vtable ( vtable ) , } } ty :: Str | ty :: Slice ( _ ) => { let ( ptr , len ) = val . to_scalar_slice ( self ) ? ; MemPlace { ptr , align : layout . align , extra : PlaceExtra :: Length ( len ) , } } _ => MemPlace { ptr : val . to_scalar ( ) ? , align : layout . align , extra : PlaceExtra :: None , } , } ; Ok ( MPlaceTy { mplace , layout } ) }
Take a value, which represents a (thin or fat) reference, and make it a place.
Take a value which represents a ( thin or fat ) reference and make it a place .
&self
val
ValTy<'tcx>