@@ -1146,7 +1146,7 @@ impl LinkCollector<'_, '_> {
1146
1146
suggest_disambiguator ( resolved, diag, path_str, dox, sp, & ori_link. range ) ;
1147
1147
} ;
1148
1148
report_diagnostic (
1149
- self . cx ,
1149
+ self . cx . tcx ,
1150
1150
BROKEN_INTRA_DOC_LINKS ,
1151
1151
& msg,
1152
1152
& item,
@@ -1220,7 +1220,7 @@ impl LinkCollector<'_, '_> {
1220
1220
&& !self . cx . tcx . features ( ) . intra_doc_pointers
1221
1221
{
1222
1222
let span = super :: source_span_for_markdown_range (
1223
- self . cx ,
1223
+ self . cx . tcx ,
1224
1224
dox,
1225
1225
& ori_link. range ,
1226
1226
& item. attrs ,
@@ -1674,15 +1674,15 @@ impl Suggestion {
1674
1674
/// parameter of the callback will contain it, and the primary span of the diagnostic will be set
1675
1675
/// to it.
1676
1676
fn report_diagnostic (
1677
- cx : & DocContext < ' _ > ,
1677
+ tcx : TyCtxt < ' _ > ,
1678
1678
lint : & ' static Lint ,
1679
1679
msg : & str ,
1680
1680
item : & Item ,
1681
1681
dox : & str ,
1682
1682
link_range : & Range < usize > ,
1683
1683
decorate : impl FnOnce ( & mut DiagnosticBuilder < ' _ > , Option < rustc_span:: Span > ) ,
1684
1684
) {
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 ) {
1686
1686
Some ( hir_id) => hir_id,
1687
1687
None => {
1688
1688
// If non-local, no need to check anything.
@@ -1694,10 +1694,10 @@ fn report_diagnostic(
1694
1694
let attrs = & item. attrs ;
1695
1695
let sp = span_of_attrs ( attrs) . unwrap_or ( item. source . span ( ) ) ;
1696
1696
1697
- cx . tcx . struct_span_lint_hir ( lint, hir_id, sp, |lint| {
1697
+ tcx. struct_span_lint_hir ( lint, hir_id, sp, |lint| {
1698
1698
let mut diag = lint. build ( msg) ;
1699
1699
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) ;
1701
1701
1702
1702
if let Some ( sp) = span {
1703
1703
diag. set_span ( sp) ;
@@ -1742,7 +1742,7 @@ fn resolution_failure(
1742
1742
) {
1743
1743
let tcx = collector. cx . tcx ;
1744
1744
report_diagnostic (
1745
- collector . cx ,
1745
+ tcx ,
1746
1746
BROKEN_INTRA_DOC_LINKS ,
1747
1747
& format ! ( "unresolved link to `{}`" , path_str) ,
1748
1748
item,
@@ -1973,7 +1973,7 @@ fn anchor_failure(
1973
1973
) ,
1974
1974
} ;
1975
1975
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| {
1977
1977
if let Some ( sp) = sp {
1978
1978
diag. span_label ( sp, "contains invalid anchor" ) ;
1979
1979
}
@@ -2013,7 +2013,7 @@ fn ambiguity_error(
2013
2013
}
2014
2014
}
2015
2015
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| {
2017
2017
if let Some ( sp) = sp {
2018
2018
diag. span_label ( sp, "ambiguous link" ) ;
2019
2019
} else {
@@ -2066,7 +2066,7 @@ fn privacy_error(cx: &DocContext<'_>, item: &Item, path_str: &str, dox: &str, li
2066
2066
let msg =
2067
2067
format ! ( "public documentation for `{}` links to private item `{}`" , item_name, path_str) ;
2068
2068
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| {
2070
2070
if let Some ( sp) = sp {
2071
2071
diag. span_label ( sp, "this item is private" ) ;
2072
2072
}
0 commit comments