@@ -5,7 +5,7 @@ use std::convert::TryInto;
55
66use rustc:: { mir, ty} ;
77use rustc:: ty:: layout:: {
8- self , Size , LayoutOf , TyLayout , HasDataLayout , IntegerExt , VariantIdx , Align ,
8+ self , Size , LayoutOf , TyLayout , HasDataLayout , IntegerExt , VariantIdx ,
99} ;
1010
1111use rustc:: mir:: interpret:: {
@@ -179,19 +179,6 @@ impl<'tcx, Tag> From<ImmTy<'tcx, Tag>> for OpTy<'tcx, Tag> {
179179 }
180180}
181181
182- impl < ' tcx , Tag > OpTy < ' tcx , Tag > {
183- /// This function exists solely for pattern matching. If we pattern match a packed struct with
184- /// an ADT field, the constant representing that field will have lost the information about the
185- /// packedness. We could clone the allocation and adjust the alignment, but that seems wasteful,
186- /// since the alignment is already encoded in the allocation. We know it is alright, because
187- /// validation checked everything before the initial constant entered match checking.
188- pub ( crate ) fn force_unaligned_access ( & mut self ) {
189- if let Operand :: Indirect ( mplace) = & mut self . op {
190- mplace. align = Align :: from_bytes ( 1 ) . unwrap ( ) ;
191- }
192- }
193- }
194-
195182impl < ' tcx , Tag : Copy > ImmTy < ' tcx , Tag >
196183{
197184 #[ inline]
@@ -551,11 +538,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> {
551538 self . layout_of ( self . monomorphize ( val. ty ) ?)
552539 } ) ?;
553540 let op = match val. val {
554- ConstValue :: ByRef ( ptr, _alloc) => {
541+ ConstValue :: ByRef ( ptr, align , _alloc) => {
555542 // We rely on mutability being set correctly in that allocation to prevent writes
556543 // where none should happen.
557544 let ptr = self . tag_static_base_pointer ( ptr) ;
558- Operand :: Indirect ( MemPlace :: from_ptr ( ptr, layout . align . abi ) )
545+ Operand :: Indirect ( MemPlace :: from_ptr ( ptr, align) )
559546 } ,
560547 ConstValue :: Scalar ( x) =>
561548 Operand :: Immediate ( Immediate :: Scalar ( tag_scalar ( x) . into ( ) ) ) ,
0 commit comments