@@ -12,9 +12,8 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
12
12
use rustc_hir:: def:: { CtorKind , DefKind , Res } ;
13
13
use rustc_hir:: def_id:: { CrateNum , DefId , LOCAL_CRATE , LocalDefId } ;
14
14
use rustc_hir:: lang_items:: LangItem ;
15
- use rustc_hir:: { BodyId , HirId , Mutability } ;
15
+ use rustc_hir:: { BodyId , Mutability } ;
16
16
use rustc_index:: IndexVec ;
17
- use rustc_lint_defs:: { BuiltinLintDiag , Lint } ;
18
17
use rustc_metadata:: rendered_const;
19
18
use rustc_middle:: span_bug;
20
19
use rustc_middle:: ty:: fast_reject:: SimplifiedType ;
@@ -478,12 +477,7 @@ impl Item {
478
477
name,
479
478
kind,
480
479
Attributes :: from_hir ( hir_attrs) ,
481
- extract_cfg_from_attrs (
482
- hir_attrs. iter ( ) ,
483
- cx. tcx ,
484
- def_id. as_local ( ) . map ( |did| cx. tcx . local_def_id_to_hir_id ( did) ) ,
485
- & cx. cache . hidden_cfg ,
486
- ) ,
480
+ extract_cfg_from_attrs ( hir_attrs. iter ( ) , cx. tcx , & cx. cache . hidden_cfg ) ,
487
481
)
488
482
}
489
483
@@ -1039,7 +1033,6 @@ pub(crate) fn hir_attr_lists<'a, I: IntoIterator<Item = &'a hir::Attribute>>(
1039
1033
pub ( crate ) fn extract_cfg_from_attrs < ' a , I : Iterator < Item = & ' a hir:: Attribute > + Clone > (
1040
1034
attrs : I ,
1041
1035
tcx : TyCtxt < ' _ > ,
1042
- hir_id : Option < HirId > ,
1043
1036
hidden_cfg : & FxHashSet < Cfg > ,
1044
1037
) -> Option < Arc < Cfg > > {
1045
1038
let doc_cfg_active = tcx. features ( ) . doc_cfg ( ) ;
@@ -1064,42 +1057,10 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute>
1064
1057
if doc_cfg. peek ( ) . is_some ( ) && doc_cfg_active {
1065
1058
let sess = tcx. sess ;
1066
1059
1067
- struct RustdocCfgMatchesLintEmitter < ' a > ( TyCtxt < ' a > , Option < HirId > ) ;
1068
-
1069
- impl < ' a > rustc_attr_parsing:: CfgMatchesLintEmitter for RustdocCfgMatchesLintEmitter < ' a > {
1070
- fn emit_span_lint (
1071
- & self ,
1072
- sess : & Session ,
1073
- lint : & ' static Lint ,
1074
- sp : rustc_span:: Span ,
1075
- builtin_diag : BuiltinLintDiag ,
1076
- ) {
1077
- if let Some ( hir_id) = self . 1 {
1078
- self . 0 . node_span_lint ( lint, hir_id, sp, |diag| {
1079
- rustc_lint:: decorate_builtin_lint (
1080
- sess,
1081
- Some ( self . 0 ) ,
1082
- builtin_diag,
1083
- diag,
1084
- )
1085
- } ) ;
1086
- } else {
1087
- // No HIR id. Probably in another crate. Don't lint.
1088
- }
1089
- }
1090
- }
1091
-
1092
1060
doc_cfg. fold ( Cfg :: True , |mut cfg, item| {
1093
1061
if let Some ( cfg_mi) =
1094
1062
item. meta_item ( ) . and_then ( |item| rustc_expand:: config:: parse_cfg ( item, sess) )
1095
1063
{
1096
- // The result is unused here but we can gate unstable predicates
1097
- rustc_attr_parsing:: cfg_matches (
1098
- cfg_mi,
1099
- tcx. sess ,
1100
- RustdocCfgMatchesLintEmitter ( tcx, hir_id) ,
1101
- Some ( tcx. features ( ) ) ,
1102
- ) ;
1103
1064
match Cfg :: parse ( cfg_mi) {
1104
1065
Ok ( new_cfg) => cfg &= new_cfg,
1105
1066
Err ( e) => {
0 commit comments