@@ -8,6 +8,7 @@ use crate::traits::*;
88use crate :: MemFlags ;
99
1010use rustc_middle:: mir;
11+ use rustc_middle:: mir:: Operand ;
1112use rustc_middle:: ty:: cast:: { CastTy , IntTy } ;
1213use rustc_middle:: ty:: layout:: { HasTyCtxt , LayoutOf } ;
1314use rustc_middle:: ty:: { self , adjustment:: PointerCast , Instance , Ty , TyCtxt } ;
@@ -344,6 +345,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
344345 self . codegen_place_to_pointer ( bx, place, mk_ref)
345346 }
346347
348+ mir:: Rvalue :: CopyForDeref ( place) => {
349+ let operand = self . codegen_operand ( & mut bx, & Operand :: Copy ( place) ) ;
350+ ( bx, operand)
351+ }
347352 mir:: Rvalue :: AddressOf ( mutability, place) => {
348353 let mk_ptr = move |tcx : TyCtxt < ' tcx > , ty : Ty < ' tcx > | {
349354 tcx. mk_ptr ( ty:: TypeAndMut { ty, mutbl : mutability } )
@@ -698,6 +703,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
698703 pub fn rvalue_creates_operand ( & self , rvalue : & mir:: Rvalue < ' tcx > , span : Span ) -> bool {
699704 match * rvalue {
700705 mir:: Rvalue :: Ref ( ..) |
706+ mir:: Rvalue :: CopyForDeref ( ..) |
701707 mir:: Rvalue :: AddressOf ( ..) |
702708 mir:: Rvalue :: Len ( ..) |
703709 mir:: Rvalue :: Cast ( ..) | // (*)
0 commit comments