@@ -31,7 +31,7 @@ use smallvec::{SmallVec, smallvec};
3131use tracing:: { debug, info, instrument, trace} ;
3232
3333use crate :: clean:: utils:: find_nearest_parent_module;
34- use crate :: clean:: { self , Crate , Item , ItemId , ItemLink , PrimitiveType } ;
34+ use crate :: clean:: { self , Crate , Item , ItemId , ItemLink , PrimitiveType , reexport_chain } ;
3535use crate :: core:: DocContext ;
3636use crate :: html:: markdown:: { MarkdownLink , MarkdownLinkRange , markdown_links} ;
3737use crate :: lint:: { BROKEN_INTRA_DOC_LINKS , PRIVATE_INTRA_DOC_LINKS } ;
@@ -1148,10 +1148,19 @@ impl LinkCollector<'_, '_> {
11481148 // `use` statement, we need to use the `def_id` of the `use` statement, not the
11491149 // inlined item.
11501150 // <https://github.com/rust-lang/rust/pull/151120>
1151- let item_id = if let Some ( inline_stmt_id) = item. inline_stmt_id
1152- && find_attr ! ( tcx, inline_stmt_id, Deprecated { span, ..} if span == depr_span)
1153- {
1154- inline_stmt_id. to_def_id ( )
1151+ let item_id = if let Some ( inline_stmt_id) = item. inline_stmt_id {
1152+ let target_def_id = item. item_id . expect_def_id ( ) ;
1153+ reexport_chain ( tcx, inline_stmt_id, target_def_id)
1154+ . iter ( )
1155+ . flat_map ( |reexport| reexport. id ( ) )
1156+ . find ( |& reexport_def_id| {
1157+ find_attr ! (
1158+ tcx,
1159+ reexport_def_id,
1160+ Deprecated { span, .. } if span == depr_span
1161+ )
1162+ } )
1163+ . unwrap_or ( target_def_id)
11551164 } else {
11561165 item. item_id . expect_def_id ( )
11571166 } ;
0 commit comments