@@ -135,6 +135,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
135135 dest. codegen_set_discr ( bx, variant_index) ;
136136 }
137137
138+ mir:: Rvalue :: Cast ( mir:: CastKind :: Transmute , ref operand, _ty) => {
139+ self . codegen_transmute_into ( bx, operand, dest) ;
140+ }
141+
138142 _ => {
139143 assert ! ( self . rvalue_creates_operand( rvalue, DUMMY_SP ) ) ;
140144 let temp = self . codegen_rvalue_operand ( bx, rvalue) ;
@@ -344,6 +348,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
344348 } ;
345349 OperandValue :: Immediate ( newval)
346350 }
351+ mir:: CastKind :: Transmute => {
352+ bug ! ( "Transmute operand {:?} in `codegen_rvalue_operand`" , operand) ;
353+ }
347354 } ;
348355 OperandRef { val, layout : cast }
349356 }
@@ -684,6 +691,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
684691impl < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > FunctionCx < ' a , ' tcx , Bx > {
685692 pub fn rvalue_creates_operand ( & self , rvalue : & mir:: Rvalue < ' tcx > , span : Span ) -> bool {
686693 match * rvalue {
694+ mir:: Rvalue :: Cast ( mir:: CastKind :: Transmute , ..) =>
695+ // sometimes this could, but for aggregates it can't
696+ false ,
687697 mir:: Rvalue :: Ref ( ..) |
688698 mir:: Rvalue :: CopyForDeref ( ..) |
689699 mir:: Rvalue :: AddressOf ( ..) |
0 commit comments