@@ -11,10 +11,11 @@ use rustc_ast::util::comments::may_have_doc_links;
1111use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexMap , FxIndexSet } ;
1212use rustc_data_structures:: intern:: Interned ;
1313use rustc_errors:: { Applicability , Diag , DiagMessage } ;
14+ use rustc_hir:: attrs:: AttributeKind ;
1415use rustc_hir:: def:: Namespace :: * ;
1516use rustc_hir:: def:: { DefKind , MacroKinds , Namespace , PerNS } ;
1617use rustc_hir:: def_id:: { CRATE_DEF_ID , DefId , LOCAL_CRATE } ;
17- use rustc_hir:: { Mutability , Safety } ;
18+ use rustc_hir:: { Attribute , Mutability , Safety } ;
1819use rustc_middle:: ty:: { Ty , TyCtxt } ;
1920use rustc_middle:: { bug, span_bug, ty} ;
2021use rustc_resolve:: rustdoc:: pulldown_cmark:: LinkType ;
@@ -1108,10 +1109,8 @@ impl LinkCollector<'_, '_> {
11081109
11091110 // Also resolve links in the note text of `#[deprecated]`.
11101111 for attr in & item. attrs . other_attrs {
1111- let rustc_hir:: Attribute :: Parsed ( rustc_hir:: attrs:: AttributeKind :: Deprecation {
1112- span,
1113- deprecation,
1114- } ) = attr
1112+ let Attribute :: Parsed ( AttributeKind :: Deprecation { span : depr_span, deprecation } ) =
1113+ attr
11151114 else {
11161115 continue ;
11171116 } ;
@@ -1128,8 +1127,14 @@ impl LinkCollector<'_, '_> {
11281127 // inlined item.
11291128 // <https://github.com/rust-lang/rust/pull/151120>
11301129 let item_id = if let Some ( inline_stmt_id) = item. inline_stmt_id
1131- && item. span ( tcx) . is_none_or ( |item_span| !item_span. inner ( ) . contains ( * span) )
1132- {
1130+ && tcx. get_all_attrs ( inline_stmt_id) . iter ( ) . any ( |attr| {
1131+ matches ! (
1132+ attr,
1133+ Attribute :: Parsed ( AttributeKind :: Deprecation {
1134+ span: attr_span, ..
1135+ } ) if attr_span == depr_span,
1136+ )
1137+ } ) {
11331138 inline_stmt_id. to_def_id ( )
11341139 } else {
11351140 item. item_id . expect_def_id ( )
0 commit comments