diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 7c83bf1d27d94..6c9fb52c8d98d 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -12,10 +12,7 @@ use rustc::mir::interpret::{ InterpResult, InterpError, InboundsCheck, sign_extend, truncate, }; -use super::{ - InterpretCx, Machine, - MemPlace, MPlaceTy, PlaceTy, Place, -}; +use super::{InterpretCx, Machine, MemPlace, MPlaceTy, PlaceTy, Place}; pub use rustc::mir::interpret::ScalarMaybeUndef; /// A `Value` represents a single immediate self-contained Rust value. @@ -190,6 +187,19 @@ impl<'tcx, Tag: Copy> ImmTy<'tcx, Tag> } } +impl<'tcx, Tag> OpTy<'tcx, Tag> +{ + /// This is used by [priroda](https://github.com/oli-obk/priroda) to create an `OpTy`. + /// + /// Do not use this from inside rustc. + pub fn from_op_and_layout_unchecked(op: Operand, layout: TyLayout<'tcx>) -> Self { + OpTy { + op, + layout, + } + } +} + // Use the existing layout if given (but sanity check in debug mode), // or compute the layout. #[inline(always)] @@ -395,7 +405,6 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> }) } - /// This is used by [priroda](https://github.com/oli-obk/priroda) to get an OpTy from a local pub fn access_local( &self, frame: &super::Frame<'mir, 'tcx, M::PointerTag, M::FrameExtra>,