@@ -10,9 +10,7 @@ use rustc_data_structures::stack::ensure_sufficient_stack;
10
10
use rustc_hir as hir;
11
11
use rustc_middle:: middle:: region;
12
12
use rustc_middle:: mir:: * ;
13
- use rustc_middle:: ty:: { self , CanonicalUserTypeAnnotation } ;
14
- use rustc_span:: symbol:: sym;
15
- use rustc_target:: spec:: abi:: Abi ;
13
+ use rustc_middle:: ty:: { CanonicalUserTypeAnnotation } ;
16
14
17
15
use std:: slice;
18
16
@@ -219,79 +217,41 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
219
217
} ,
220
218
)
221
219
}
222
- ExprKind :: Call { ty, fun, args, from_hir_call, fn_span } => {
223
- let intrinsic = match * ty. kind ( ) {
224
- ty:: FnDef ( def_id, _) => {
225
- let f = ty. fn_sig ( this. hir . tcx ( ) ) ;
226
- if f. abi ( ) == Abi :: RustIntrinsic || f. abi ( ) == Abi :: PlatformIntrinsic {
227
- Some ( this. hir . tcx ( ) . item_name ( def_id) )
228
- } else {
229
- None
230
- }
231
- }
232
- _ => None ,
233
- } ;
220
+ ExprKind :: Call { ty : _, fun, args, from_hir_call, fn_span } => {
234
221
let fun = unpack ! ( block = this. as_local_operand( block, fun) ) ;
235
- if let Some ( sym:: move_val_init) = intrinsic {
236
- // `move_val_init` has "magic" semantics - the second argument is
237
- // always evaluated "directly" into the first one.
238
-
239
- let mut args = args. into_iter ( ) ;
240
- let ptr = args. next ( ) . expect ( "0 arguments to `move_val_init`" ) ;
241
- let val = args. next ( ) . expect ( "1 argument to `move_val_init`" ) ;
242
- assert ! ( args. next( ) . is_none( ) , ">2 arguments to `move_val_init`" ) ;
243
-
244
- let ptr = this. hir . mirror ( ptr) ;
245
- let ptr_ty = ptr. ty ;
246
- // Create an *internal* temp for the pointer, so that unsafety
247
- // checking won't complain about the raw pointer assignment.
248
- let ptr_temp = this
249
- . local_decls
250
- . push ( LocalDecl :: with_source_info ( ptr_ty, source_info) . internal ( ) ) ;
251
- let ptr_temp = Place :: from ( ptr_temp) ;
252
- // No need for a scope, ptr_temp doesn't need drop
253
- let block = unpack ! ( this. into( ptr_temp, None , block, ptr) ) ;
254
- // Maybe we should provide a scope here so that
255
- // `move_val_init` wouldn't leak on panic even with an
256
- // arbitrary `val` expression, but `schedule_drop`,
257
- // borrowck and drop elaboration all prevent us from
258
- // dropping `ptr_temp.deref()`.
259
- this. into ( this. hir . tcx ( ) . mk_place_deref ( ptr_temp) , None , block, val)
260
- } else {
261
- let args: Vec < _ > = args
262
- . into_iter ( )
263
- . map ( |arg| unpack ! ( block = this. as_local_call_operand( block, arg) ) )
264
- . collect ( ) ;
265
-
266
- let success = this. cfg . start_new_block ( ) ;
267
-
268
- this. record_operands_moved ( & args) ;
269
-
270
- debug ! ( "into_expr: fn_span={:?}" , fn_span) ;
271
-
272
- this. cfg . terminate (
273
- block,
274
- source_info,
275
- TerminatorKind :: Call {
276
- func : fun,
277
- args,
278
- cleanup : None ,
279
- // FIXME(varkor): replace this with an uninhabitedness-based check.
280
- // This requires getting access to the current module to call
281
- // `tcx.is_ty_uninhabited_from`, which is currently tricky to do.
282
- destination : if expr. ty . is_never ( ) {
283
- None
284
- } else {
285
- Some ( ( destination, success) )
286
- } ,
287
- from_hir_call,
288
- fn_span,
222
+ let args: Vec < _ > = args
223
+ . into_iter ( )
224
+ . map ( |arg| unpack ! ( block = this. as_local_call_operand( block, arg) ) )
225
+ . collect ( ) ;
226
+
227
+ let success = this. cfg . start_new_block ( ) ;
228
+
229
+ this. record_operands_moved ( & args) ;
230
+
231
+ debug ! ( "into_expr: fn_span={:?}" , fn_span) ;
232
+
233
+ this. cfg . terminate (
234
+ block,
235
+ source_info,
236
+ TerminatorKind :: Call {
237
+ func : fun,
238
+ args,
239
+ cleanup : None ,
240
+ // FIXME(varkor): replace this with an uninhabitedness-based check.
241
+ // This requires getting access to the current module to call
242
+ // `tcx.is_ty_uninhabited_from`, which is currently tricky to do.
243
+ destination : if expr. ty . is_never ( ) {
244
+ None
245
+ } else {
246
+ Some ( ( destination, success) )
289
247
} ,
290
- ) ;
291
- this. diverge_from ( block) ;
292
- schedule_drop ( this) ;
293
- success. unit ( )
294
- }
248
+ from_hir_call,
249
+ fn_span,
250
+ } ,
251
+ ) ;
252
+ this. diverge_from ( block) ;
253
+ schedule_drop ( this) ;
254
+ success. unit ( )
295
255
}
296
256
ExprKind :: Use { source } => this. into ( destination, scope, block, source) ,
297
257
ExprKind :: Borrow { arg, borrow_kind } => {
0 commit comments