@@ -106,7 +106,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
106106 def_id : LocalDefId ,
107107 item_sp : Span ,
108108 fn_sig : Option < & ' tcx hir:: FnSig < ' tcx > > ,
109- is_foreign_item : bool ,
110109 kind : AnnotationKind ,
111110 inherit_deprecation : InheritDeprecation ,
112111 inherit_const_stability : InheritConstStability ,
@@ -175,11 +174,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
175174 // implied), check if the function/method is const or the parent impl block is const.
176175 if let Some ( fn_sig) = fn_sig
177176 && !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
181177 && const_stab. is_some ( )
182- && ( !self . in_trait_impl || !self . tcx . is_const_fn ( def_id. to_def_id ( ) ) )
183178 {
184179 self . tcx . dcx ( ) . emit_err ( errors:: MissingConstErr { fn_sig_span : fn_sig. span } ) ;
185180 }
@@ -398,7 +393,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
398393 ctor_def_id,
399394 i. span ,
400395 None ,
401- /* is_foreign_item */ false ,
402396 AnnotationKind :: Required ,
403397 InheritDeprecation :: Yes ,
404398 InheritConstStability :: No ,
@@ -417,7 +411,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
417411 i. owner_id . def_id ,
418412 i. span ,
419413 fn_sig,
420- /* is_foreign_item */ false ,
421414 kind,
422415 InheritDeprecation :: Yes ,
423416 const_stab_inherit,
@@ -437,7 +430,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
437430 ti. owner_id . def_id ,
438431 ti. span ,
439432 fn_sig,
440- /* is_foreign_item */ false ,
441433 AnnotationKind :: Required ,
442434 InheritDeprecation :: Yes ,
443435 InheritConstStability :: No ,
@@ -461,7 +453,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
461453 ii. owner_id . def_id ,
462454 ii. span ,
463455 fn_sig,
464- /* is_foreign_item */ false ,
465456 kind,
466457 InheritDeprecation :: Yes ,
467458 InheritConstStability :: No ,
@@ -477,7 +468,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
477468 var. def_id ,
478469 var. span ,
479470 None ,
480- /* is_foreign_item */ false ,
481471 AnnotationKind :: Required ,
482472 InheritDeprecation :: Yes ,
483473 InheritConstStability :: No ,
@@ -488,7 +478,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
488478 ctor_def_id,
489479 var. span ,
490480 None ,
491- /* is_foreign_item */ false ,
492481 AnnotationKind :: Required ,
493482 InheritDeprecation :: Yes ,
494483 InheritConstStability :: No ,
@@ -507,7 +496,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
507496 s. def_id ,
508497 s. span ,
509498 None ,
510- /* is_foreign_item */ false ,
511499 AnnotationKind :: Required ,
512500 InheritDeprecation :: Yes ,
513501 InheritConstStability :: No ,
@@ -527,7 +515,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
527515 i. owner_id . def_id ,
528516 i. span ,
529517 fn_sig,
530- /* is_foreign_item */ true ,
531518 AnnotationKind :: Required ,
532519 InheritDeprecation :: Yes ,
533520 InheritConstStability :: No ,
@@ -550,7 +537,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
550537 p. def_id ,
551538 p. span ,
552539 None ,
553- /* is_foreign_item */ false ,
554540 kind,
555541 InheritDeprecation :: No ,
556542 InheritConstStability :: No ,
@@ -712,7 +698,6 @@ fn stability_index(tcx: TyCtxt<'_>, (): ()) -> Index {
712698 CRATE_DEF_ID ,
713699 tcx. hir ( ) . span ( CRATE_HIR_ID ) ,
714700 None ,
715- /* is_foreign_item */ false ,
716701 AnnotationKind :: Required ,
717702 InheritDeprecation :: Yes ,
718703 InheritConstStability :: No ,
0 commit comments