@@ -268,7 +268,7 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
268
268
destination : CPlace < ' tcx > ,
269
269
target : Option < BasicBlock > ,
270
270
source_info : mir:: SourceInfo ,
271
- ) -> Result < ( ) , ( ) > {
271
+ ) -> Result < ( ) , Instance < ' tcx > > {
272
272
let intrinsic = fx. tcx . item_name ( instance. def_id ( ) ) ;
273
273
let instance_args = instance. args ;
274
274
@@ -431,7 +431,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
431
431
ret : CPlace < ' tcx > ,
432
432
destination : Option < BasicBlock > ,
433
433
source_info : mir:: SourceInfo ,
434
- ) -> Result < ( ) , ( ) > {
434
+ ) -> Result < ( ) , Instance < ' tcx > > {
435
435
assert_eq ! ( generic_args, instance. args) ;
436
436
let usize_layout = fx. layout_of ( fx. tcx . types . usize ) ;
437
437
@@ -1229,14 +1229,6 @@ fn codegen_regular_intrinsic_call<'tcx>(
1229
1229
ret. write_cvalue ( fx, CValue :: by_val ( cmp, ret. layout ( ) ) ) ;
1230
1230
}
1231
1231
1232
- sym:: const_allocate => {
1233
- intrinsic_args ! ( fx, args => ( _size, _align) ; intrinsic) ;
1234
-
1235
- // returns a null pointer at runtime.
1236
- let null = fx. bcx . ins ( ) . iconst ( fx. pointer_type , 0 ) ;
1237
- ret. write_cvalue ( fx, CValue :: by_val ( null, ret. layout ( ) ) ) ;
1238
- }
1239
-
1240
1232
sym:: const_deallocate => {
1241
1233
intrinsic_args ! ( fx, args => ( _ptr, _size, _align) ; intrinsic) ;
1242
1234
// nop at runtime.
@@ -1257,7 +1249,9 @@ fn codegen_regular_intrinsic_call<'tcx>(
1257
1249
) ;
1258
1250
}
1259
1251
1260
- _ => return Err ( ( ) ) ,
1252
+ // Unimplemented intrinsics must have a fallback body. The fallback body is obtained
1253
+ // by converting the `InstanceDef::Intrinsic` to an `InstanceDef::Item`.
1254
+ _ => return Err ( Instance :: new ( instance. def_id ( ) , instance. args ) ) ,
1261
1255
}
1262
1256
1263
1257
let ret_block = fx. get_block ( destination. unwrap ( ) ) ;
0 commit comments