@@ -106,7 +106,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
106
106
def_id : LocalDefId ,
107
107
item_sp : Span ,
108
108
fn_sig : Option < & ' tcx hir:: FnSig < ' tcx > > ,
109
- is_foreign_item : bool ,
110
109
kind : AnnotationKind ,
111
110
inherit_deprecation : InheritDeprecation ,
112
111
inherit_const_stability : InheritConstStability ,
@@ -175,11 +174,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
175
174
// implied), check if the function/method is const or the parent impl block is const.
176
175
if let Some ( fn_sig) = fn_sig
177
176
&& !fn_sig. header . is_const ( )
178
- // We have to exclude foreign items as they might be intrinsics. Sadly we can't check
179
- // their ABI; `fn_sig.abi` is *not* correct for foreign functions.
180
- && !is_foreign_item
181
177
&& const_stab. is_some ( )
182
- && ( !self . in_trait_impl || !self . tcx . is_const_fn ( def_id. to_def_id ( ) ) )
183
178
{
184
179
self . tcx . dcx ( ) . emit_err ( errors:: MissingConstErr { fn_sig_span : fn_sig. span } ) ;
185
180
}
@@ -398,7 +393,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
398
393
ctor_def_id,
399
394
i. span ,
400
395
None ,
401
- /* is_foreign_item */ false ,
402
396
AnnotationKind :: Required ,
403
397
InheritDeprecation :: Yes ,
404
398
InheritConstStability :: No ,
@@ -417,7 +411,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
417
411
i. owner_id . def_id ,
418
412
i. span ,
419
413
fn_sig,
420
- /* is_foreign_item */ false ,
421
414
kind,
422
415
InheritDeprecation :: Yes ,
423
416
const_stab_inherit,
@@ -437,7 +430,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
437
430
ti. owner_id . def_id ,
438
431
ti. span ,
439
432
fn_sig,
440
- /* is_foreign_item */ false ,
441
433
AnnotationKind :: Required ,
442
434
InheritDeprecation :: Yes ,
443
435
InheritConstStability :: No ,
@@ -461,7 +453,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
461
453
ii. owner_id . def_id ,
462
454
ii. span ,
463
455
fn_sig,
464
- /* is_foreign_item */ false ,
465
456
kind,
466
457
InheritDeprecation :: Yes ,
467
458
InheritConstStability :: No ,
@@ -477,7 +468,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
477
468
var. def_id ,
478
469
var. span ,
479
470
None ,
480
- /* is_foreign_item */ false ,
481
471
AnnotationKind :: Required ,
482
472
InheritDeprecation :: Yes ,
483
473
InheritConstStability :: No ,
@@ -488,7 +478,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
488
478
ctor_def_id,
489
479
var. span ,
490
480
None ,
491
- /* is_foreign_item */ false ,
492
481
AnnotationKind :: Required ,
493
482
InheritDeprecation :: Yes ,
494
483
InheritConstStability :: No ,
@@ -507,7 +496,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
507
496
s. def_id ,
508
497
s. span ,
509
498
None ,
510
- /* is_foreign_item */ false ,
511
499
AnnotationKind :: Required ,
512
500
InheritDeprecation :: Yes ,
513
501
InheritConstStability :: No ,
@@ -527,7 +515,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
527
515
i. owner_id . def_id ,
528
516
i. span ,
529
517
fn_sig,
530
- /* is_foreign_item */ true ,
531
518
AnnotationKind :: Required ,
532
519
InheritDeprecation :: Yes ,
533
520
InheritConstStability :: No ,
@@ -550,7 +537,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
550
537
p. def_id ,
551
538
p. span ,
552
539
None ,
553
- /* is_foreign_item */ false ,
554
540
kind,
555
541
InheritDeprecation :: No ,
556
542
InheritConstStability :: No ,
@@ -712,7 +698,6 @@ fn stability_index(tcx: TyCtxt<'_>, (): ()) -> Index {
712
698
CRATE_DEF_ID ,
713
699
tcx. hir ( ) . span ( CRATE_HIR_ID ) ,
714
700
None ,
715
- /* is_foreign_item */ false ,
716
701
AnnotationKind :: Required ,
717
702
InheritDeprecation :: Yes ,
718
703
InheritConstStability :: No ,
0 commit comments