@@ -8,6 +8,7 @@ use crate::traits::*;
8
8
use crate :: MemFlags ;
9
9
10
10
use rustc_middle:: mir;
11
+ use rustc_middle:: mir:: Operand ;
11
12
use rustc_middle:: ty:: cast:: { CastTy , IntTy } ;
12
13
use rustc_middle:: ty:: layout:: { HasTyCtxt , LayoutOf } ;
13
14
use rustc_middle:: ty:: { self , adjustment:: PointerCast , Instance , Ty , TyCtxt } ;
@@ -344,6 +345,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
344
345
self . codegen_place_to_pointer ( bx, place, mk_ref)
345
346
}
346
347
348
+ mir:: Rvalue :: CopyForDeref ( place) => {
349
+ let operand = self . codegen_operand ( & mut bx, & Operand :: Copy ( place) ) ;
350
+ ( bx, operand)
351
+ }
347
352
mir:: Rvalue :: AddressOf ( mutability, place) => {
348
353
let mk_ptr = move |tcx : TyCtxt < ' tcx > , ty : Ty < ' tcx > | {
349
354
tcx. mk_ptr ( ty:: TypeAndMut { ty, mutbl : mutability } )
@@ -698,6 +703,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
698
703
pub fn rvalue_creates_operand ( & self , rvalue : & mir:: Rvalue < ' tcx > , span : Span ) -> bool {
699
704
match * rvalue {
700
705
mir:: Rvalue :: Ref ( ..) |
706
+ mir:: Rvalue :: CopyForDeref ( ..) |
701
707
mir:: Rvalue :: AddressOf ( ..) |
702
708
mir:: Rvalue :: Len ( ..) |
703
709
mir:: Rvalue :: Cast ( ..) | // (*)
0 commit comments