@@ -311,34 +311,6 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
311
311
Ok ( ( ) )
312
312
}
313
313
314
- fn check_fn_target_features ( & self , instance : ty:: Instance < ' tcx > ) -> InterpResult < ' tcx , ( ) > {
315
- // Calling functions with `#[target_feature]` is not unsafe on WASM, see #84988
316
- let attrs = self . tcx . codegen_fn_attrs ( instance. def_id ( ) ) ;
317
- if !self . tcx . sess . target . is_like_wasm
318
- && attrs
319
- . target_features
320
- . iter ( )
321
- . any ( |feature| !self . tcx . sess . target_features . contains ( & feature. name ) )
322
- {
323
- throw_ub_custom ! (
324
- fluent:: const_eval_unavailable_target_features_for_fn,
325
- unavailable_feats = attrs
326
- . target_features
327
- . iter( )
328
- . filter( |& feature| !feature. implied
329
- && !self . tcx. sess. target_features. contains( & feature. name) )
330
- . fold( String :: new( ) , |mut s, feature| {
331
- if !s. is_empty( ) {
332
- s. push_str( ", " ) ;
333
- }
334
- s. push_str( feature. name. as_str( ) ) ;
335
- s
336
- } ) ,
337
- ) ;
338
- }
339
- Ok ( ( ) )
340
- }
341
-
342
314
/// The main entry point for creating a new stack frame: performs ABI checks and initializes
343
315
/// arguments.
344
316
#[ instrument( skip( self ) , level = "trace" ) ]
@@ -360,20 +332,18 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
360
332
throw_unsup_format ! ( "calling a c-variadic function is not supported" ) ;
361
333
}
362
334
363
- if M :: enforce_abi ( self ) {
364
- if caller_fn_abi. conv != callee_fn_abi. conv {
365
- throw_ub_custom ! (
366
- fluent:: const_eval_incompatible_calling_conventions,
367
- callee_conv = format!( "{:?}" , callee_fn_abi. conv) ,
368
- caller_conv = format!( "{:?}" , caller_fn_abi. conv) ,
369
- )
370
- }
335
+ if caller_fn_abi. conv != callee_fn_abi. conv {
336
+ throw_ub_custom ! (
337
+ fluent:: const_eval_incompatible_calling_conventions,
338
+ callee_conv = format!( "{:?}" , callee_fn_abi. conv) ,
339
+ caller_conv = format!( "{:?}" , caller_fn_abi. conv) ,
340
+ )
371
341
}
372
342
373
343
// Check that all target features required by the callee (i.e., from
374
344
// the attribute `#[target_feature(enable = ...)]`) are enabled at
375
345
// compile time.
376
- self . check_fn_target_features ( instance) ?;
346
+ M :: check_fn_target_features ( self , instance) ?;
377
347
378
348
if !callee_fn_abi. can_unwind {
379
349
// The callee cannot unwind, so force the `Unreachable` unwind handling.
0 commit comments