@@ -65,7 +65,7 @@ pub fn trans_promoted<'a, 'tcx: 'a>(
65
65
} ) )
66
66
{
67
67
Ok ( const_) => {
68
- let cplace = trans_const_place ( fx, * const_) ;
68
+ let cplace = trans_const_place ( fx, const_) ;
69
69
debug_assert_eq ! ( cplace. layout( ) , fx. layout_of( dest_ty) ) ;
70
70
cplace
71
71
}
@@ -90,7 +90,7 @@ pub fn trans_constant<'a, 'tcx: 'a>(
90
90
pub fn force_eval_const < ' a , ' tcx : ' a > (
91
91
fx : & mut FunctionCx < ' a , ' tcx , impl Backend > ,
92
92
const_ : & ' tcx Const ,
93
- ) -> Const < ' tcx > {
93
+ ) -> & ' tcx Const < ' tcx > {
94
94
match const_. val {
95
95
ConstValue :: Unevaluated ( def_id, ref substs) => {
96
96
let param_env = ParamEnv :: reveal_all ( ) ;
@@ -100,15 +100,15 @@ pub fn force_eval_const<'a, 'tcx: 'a>(
100
100
instance,
101
101
promoted : None ,
102
102
} ;
103
- * fx. tcx . const_eval ( param_env. and ( cid) ) . unwrap ( )
103
+ fx. tcx . const_eval ( param_env. and ( cid) ) . unwrap ( )
104
104
}
105
- _ => * fx. monomorphize ( & const_) ,
105
+ _ => fx. monomorphize ( & const_) ,
106
106
}
107
107
}
108
108
109
109
pub fn trans_const_value < ' a , ' tcx : ' a > (
110
110
fx : & mut FunctionCx < ' a , ' tcx , impl Backend > ,
111
- const_ : Const < ' tcx > ,
111
+ const_ : & ' tcx Const < ' tcx > ,
112
112
) -> CValue < ' tcx > {
113
113
let ty = fx. monomorphize ( & const_. ty ) ;
114
114
let layout = fx. layout_of ( ty) ;
@@ -137,7 +137,7 @@ pub fn trans_const_value<'a, 'tcx: 'a>(
137
137
138
138
fn trans_const_place < ' a , ' tcx : ' a > (
139
139
fx : & mut FunctionCx < ' a , ' tcx , impl Backend > ,
140
- const_ : Const < ' tcx > ,
140
+ const_ : & ' tcx Const < ' tcx > ,
141
141
) -> CPlace < ' tcx > {
142
142
// Adapted from https://github.com/rust-lang/rust/pull/53671/files#diff-e0b58bb6712edaa8595ad7237542c958L551
143
143
let result = || -> InterpResult < ' tcx , & ' tcx Allocation > {
@@ -160,13 +160,13 @@ fn trans_const_place<'a, 'tcx: 'a>(
160
160
span : DUMMY_SP ,
161
161
ty : const_. ty ,
162
162
user_ty : None ,
163
- literal : fx . tcx . mk_const ( const_) ,
163
+ literal : const_,
164
164
} ) ) ,
165
165
None ,
166
166
) ?;
167
167
let ptr = ecx. allocate ( op. layout , MemoryKind :: Stack ) ;
168
168
ecx. copy_op ( op, ptr. into ( ) ) ?;
169
- let alloc = ecx. memory ( ) . get ( ptr. to_ptr ( ) ?. alloc_id ) ?;
169
+ let alloc = ecx. memory ( ) . get ( ptr. to_ref ( ) . to_scalar ( ) ? . to_ptr ( ) ?. alloc_id ) ?;
170
170
Ok ( fx. tcx . intern_const_alloc ( alloc. clone ( ) ) )
171
171
} ;
172
172
let alloc = result ( ) . expect ( "unable to convert ConstValue to Allocation" ) ;
0 commit comments