@@ -6,14 +6,14 @@ use rustc_errors::SuggestionStyle;
66use  rustc_hir:: def:: { DefKind ,  DocLinkResMap ,  Namespace ,  Res } ; 
77use  rustc_hir:: HirId ; 
88use  rustc_lint_defs:: Applicability ; 
9+ use  rustc_resolve:: rustdoc:: source_span_for_markdown_range; 
910use  rustc_span:: Symbol ; 
1011
1112use  crate :: clean:: utils:: find_nearest_parent_module; 
1213use  crate :: clean:: utils:: inherits_doc_hidden; 
1314use  crate :: clean:: Item ; 
1415use  crate :: core:: DocContext ; 
1516use  crate :: html:: markdown:: main_body_opts; 
16- use  crate :: passes:: source_span_for_markdown_range; 
1717
1818#[ derive( Debug ) ]  
1919struct  LinkData  { 
@@ -160,16 +160,21 @@ fn check_inline_or_reference_unknown_redundancy(
160160        ( find_resolution ( resolutions,  & dest) ?,  find_resolution ( resolutions,  resolvable_link) ?) ; 
161161
162162    if  dest_res == display_res { 
163-         let  link_span = source_span_for_markdown_range ( cx. tcx ,  & doc,  & link_range,  & item. attrs ) 
164-             . unwrap_or ( item. attr_span ( cx. tcx ) ) ; 
163+         let  link_span =
164+             source_span_for_markdown_range ( cx. tcx ,  & doc,  & link_range,  & item. attrs . doc_strings ) 
165+                 . unwrap_or ( item. attr_span ( cx. tcx ) ) ; 
165166        let  explicit_span = source_span_for_markdown_range ( 
166167            cx. tcx , 
167168            & doc, 
168169            & offset_explicit_range ( doc,  link_range,  open,  close) , 
169-             & item. attrs , 
170+             & item. attrs . doc_strings , 
171+         ) ?; 
172+         let  display_span = source_span_for_markdown_range ( 
173+             cx. tcx , 
174+             & doc, 
175+             & resolvable_link_range, 
176+             & item. attrs . doc_strings , 
170177        ) ?; 
171-         let  display_span =
172-             source_span_for_markdown_range ( cx. tcx ,  & doc,  & resolvable_link_range,  & item. attrs ) ?; 
173178
174179        cx. tcx . struct_span_lint_hir ( crate :: lint:: REDUNDANT_EXPLICIT_LINKS ,  hir_id,  explicit_span,  "redundant explicit link target" ,  |lint| { 
175180            lint. span_label ( explicit_span,  "explicit target is redundant" ) 
@@ -201,21 +206,26 @@ fn check_reference_redundancy(
201206        ( find_resolution ( resolutions,  & dest) ?,  find_resolution ( resolutions,  resolvable_link) ?) ; 
202207
203208    if  dest_res == display_res { 
204-         let  link_span = source_span_for_markdown_range ( cx. tcx ,  & doc,  & link_range,  & item. attrs ) 
205-             . unwrap_or ( item. attr_span ( cx. tcx ) ) ; 
209+         let  link_span =
210+             source_span_for_markdown_range ( cx. tcx ,  & doc,  & link_range,  & item. attrs . doc_strings ) 
211+                 . unwrap_or ( item. attr_span ( cx. tcx ) ) ; 
206212        let  explicit_span = source_span_for_markdown_range ( 
207213            cx. tcx , 
208214            & doc, 
209215            & offset_explicit_range ( doc,  link_range. clone ( ) ,  b'[' ,  b']' ) , 
210-             & item. attrs , 
216+             & item. attrs . doc_strings , 
217+         ) ?; 
218+         let  display_span = source_span_for_markdown_range ( 
219+             cx. tcx , 
220+             & doc, 
221+             & resolvable_link_range, 
222+             & item. attrs . doc_strings , 
211223        ) ?; 
212-         let  display_span =
213-             source_span_for_markdown_range ( cx. tcx ,  & doc,  & resolvable_link_range,  & item. attrs ) ?; 
214224        let  def_span = source_span_for_markdown_range ( 
215225            cx. tcx , 
216226            & doc, 
217227            & offset_reference_def_range ( doc,  dest,  link_range) , 
218-             & item. attrs , 
228+             & item. attrs . doc_strings , 
219229        ) ?; 
220230
221231        cx. tcx . struct_span_lint_hir ( crate :: lint:: REDUNDANT_EXPLICIT_LINKS ,  hir_id,  explicit_span,  "redundant explicit link target" ,  |lint| { 
0 commit comments