@@ -1146,7 +1146,7 @@ impl LinkCollector<'_, '_> {
11461146 suggest_disambiguator ( resolved, diag, path_str, dox, sp, & ori_link. range ) ;
11471147 } ;
11481148 report_diagnostic (
1149- self . cx ,
1149+ self . cx . tcx ,
11501150 BROKEN_INTRA_DOC_LINKS ,
11511151 & msg,
11521152 & item,
@@ -1220,7 +1220,7 @@ impl LinkCollector<'_, '_> {
12201220 && !self . cx . tcx . features ( ) . intra_doc_pointers
12211221 {
12221222 let span = super :: source_span_for_markdown_range (
1223- self . cx ,
1223+ self . cx . tcx ,
12241224 dox,
12251225 & ori_link. range ,
12261226 & item. attrs ,
@@ -1674,15 +1674,15 @@ impl Suggestion {
16741674/// parameter of the callback will contain it, and the primary span of the diagnostic will be set
16751675/// to it.
16761676fn report_diagnostic (
1677- cx : & DocContext < ' _ > ,
1677+ tcx : TyCtxt < ' _ > ,
16781678 lint : & ' static Lint ,
16791679 msg : & str ,
16801680 item : & Item ,
16811681 dox : & str ,
16821682 link_range : & Range < usize > ,
16831683 decorate : impl FnOnce ( & mut DiagnosticBuilder < ' _ > , Option < rustc_span:: Span > ) ,
16841684) {
1685- let hir_id = match cx . as_local_hir_id ( item. def_id ) {
1685+ let hir_id = match DocContext :: as_local_hir_id ( tcx , item. def_id ) {
16861686 Some ( hir_id) => hir_id,
16871687 None => {
16881688 // If non-local, no need to check anything.
@@ -1694,10 +1694,10 @@ fn report_diagnostic(
16941694 let attrs = & item. attrs ;
16951695 let sp = span_of_attrs ( attrs) . unwrap_or ( item. source . span ( ) ) ;
16961696
1697- cx . tcx . struct_span_lint_hir ( lint, hir_id, sp, |lint| {
1697+ tcx. struct_span_lint_hir ( lint, hir_id, sp, |lint| {
16981698 let mut diag = lint. build ( msg) ;
16991699
1700- let span = super :: source_span_for_markdown_range ( cx , dox, link_range, attrs) ;
1700+ let span = super :: source_span_for_markdown_range ( tcx , dox, link_range, attrs) ;
17011701
17021702 if let Some ( sp) = span {
17031703 diag. set_span ( sp) ;
@@ -1742,7 +1742,7 @@ fn resolution_failure(
17421742) {
17431743 let tcx = collector. cx . tcx ;
17441744 report_diagnostic (
1745- collector . cx ,
1745+ tcx ,
17461746 BROKEN_INTRA_DOC_LINKS ,
17471747 & format ! ( "unresolved link to `{}`" , path_str) ,
17481748 item,
@@ -1973,7 +1973,7 @@ fn anchor_failure(
19731973 ) ,
19741974 } ;
19751975
1976- report_diagnostic ( cx, BROKEN_INTRA_DOC_LINKS , & msg, item, dox, & link_range, |diag, sp| {
1976+ report_diagnostic ( cx. tcx , BROKEN_INTRA_DOC_LINKS , & msg, item, dox, & link_range, |diag, sp| {
19771977 if let Some ( sp) = sp {
19781978 diag. span_label ( sp, "contains invalid anchor" ) ;
19791979 }
@@ -2013,7 +2013,7 @@ fn ambiguity_error(
20132013 }
20142014 }
20152015
2016- report_diagnostic ( cx, BROKEN_INTRA_DOC_LINKS , & msg, item, dox, & link_range, |diag, sp| {
2016+ report_diagnostic ( cx. tcx , BROKEN_INTRA_DOC_LINKS , & msg, item, dox, & link_range, |diag, sp| {
20172017 if let Some ( sp) = sp {
20182018 diag. span_label ( sp, "ambiguous link" ) ;
20192019 } else {
@@ -2066,7 +2066,7 @@ fn privacy_error(cx: &DocContext<'_>, item: &Item, path_str: &str, dox: &str, li
20662066 let msg =
20672067 format ! ( "public documentation for `{}` links to private item `{}`" , item_name, path_str) ;
20682068
2069- report_diagnostic ( cx, PRIVATE_INTRA_DOC_LINKS , & msg, item, dox, & link. range , |diag, sp| {
2069+ report_diagnostic ( cx. tcx , PRIVATE_INTRA_DOC_LINKS , & msg, item, dox, & link. range , |diag, sp| {
20702070 if let Some ( sp) = sp {
20712071 diag. span_label ( sp, "this item is private" ) ;
20722072 }
0 commit comments