@@ -218,34 +218,18 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
218
218
let intrinsic = fx. tcx . item_name ( instance. def_id ( ) ) ;
219
219
let substs = instance. substs ;
220
220
221
- let target = if let Some ( target) = target {
222
- target
223
- } else {
224
- // Insert non returning intrinsics here
225
- match intrinsic {
226
- sym:: abort => {
227
- fx. bcx . ins ( ) . trap ( TrapCode :: User ( 0 ) ) ;
228
- }
229
- sym:: transmute => {
230
- crate :: base:: codegen_panic ( fx, "Transmuting to uninhabited type." , source_info) ;
231
- }
232
- _ => unimplemented ! ( "unsupported intrinsic {}" , intrinsic) ,
233
- }
234
- return ;
235
- } ;
236
-
237
221
if intrinsic. as_str ( ) . starts_with ( "simd_" ) {
238
222
self :: simd:: codegen_simd_intrinsic_call (
239
223
fx,
240
224
intrinsic,
241
225
substs,
242
226
args,
243
227
destination,
244
- target,
228
+ target. expect ( "target for simd intrinsic" ) ,
245
229
source_info. span ,
246
230
) ;
247
231
} else if codegen_float_intrinsic_call ( fx, intrinsic, args, destination) {
248
- let ret_block = fx. get_block ( target) ;
232
+ let ret_block = fx. get_block ( target. expect ( "target for float intrinsic" ) ) ;
249
233
fx. bcx . ins ( ) . jump ( ret_block, & [ ] ) ;
250
234
} else {
251
235
codegen_regular_intrinsic_call (
@@ -255,7 +239,7 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
255
239
substs,
256
240
args,
257
241
destination,
258
- Some ( target) ,
242
+ target,
259
243
source_info,
260
244
) ;
261
245
}
@@ -382,6 +366,10 @@ fn codegen_regular_intrinsic_call<'tcx>(
382
366
let usize_layout = fx. layout_of ( fx. tcx . types . usize ) ;
383
367
384
368
match intrinsic {
369
+ sym:: abort => {
370
+ fx. bcx . ins ( ) . trap ( TrapCode :: User ( 0 ) ) ;
371
+ return ;
372
+ }
385
373
sym:: likely | sym:: unlikely => {
386
374
intrinsic_args ! ( fx, args => ( a) ; intrinsic) ;
387
375
@@ -579,6 +567,11 @@ fn codegen_regular_intrinsic_call<'tcx>(
579
567
sym:: transmute => {
580
568
intrinsic_args ! ( fx, args => ( from) ; intrinsic) ;
581
569
570
+ if ret. layout ( ) . abi . is_uninhabited ( ) {
571
+ crate :: base:: codegen_panic ( fx, "Transmuting to uninhabited type." , source_info) ;
572
+ return ;
573
+ }
574
+
582
575
ret. write_cvalue_transmute ( fx, from) ;
583
576
}
584
577
sym:: write_bytes | sym:: volatile_set_memory => {
0 commit comments