@@ -12,8 +12,6 @@ use rustc_hir::def_id::{DefId, DefIdMap, DefIdSet, CRATE_DEF_ID};
12
12
use rustc_hir:: TraitCandidate ;
13
13
use rustc_middle:: ty:: { DefIdTree , Visibility } ;
14
14
use rustc_resolve:: { ParentScope , Resolver } ;
15
- use rustc_session:: config:: Externs ;
16
- use rustc_session:: Session ;
17
15
use rustc_span:: symbol:: sym;
18
16
use rustc_span:: { Symbol , SyntaxContext } ;
19
17
@@ -22,16 +20,13 @@ use std::mem;
22
20
23
21
pub ( crate ) fn early_resolve_intra_doc_links (
24
22
resolver : & mut Resolver < ' _ > ,
25
- sess : & Session ,
26
23
krate : & ast:: Crate ,
27
- externs : Externs ,
28
24
document_private_items : bool ,
29
25
) -> ResolverCaches {
30
26
let parent_scope =
31
27
ParentScope :: module ( resolver. expect_module ( CRATE_DEF_ID . to_def_id ( ) ) , resolver) ;
32
28
let mut link_resolver = EarlyDocLinkResolver {
33
29
resolver,
34
- sess,
35
30
parent_scope,
36
31
visited_mods : Default :: default ( ) ,
37
32
markdown_links : Default :: default ( ) ,
@@ -52,7 +47,9 @@ pub(crate) fn early_resolve_intra_doc_links(
52
47
// the known necessary crates. Load them all unconditionally until we find a way to fix this.
53
48
// DO NOT REMOVE THIS without first testing on the reproducer in
54
49
// https://github.com/jyn514/objr/commit/edcee7b8124abf0e4c63873e8422ff81beb11ebb
55
- for ( extern_name, _) in externs. iter ( ) . filter ( |( _, entry) | entry. add_prelude ) {
50
+ for ( extern_name, _) in
51
+ link_resolver. resolver . sess ( ) . opts . externs . iter ( ) . filter ( |( _, entry) | entry. add_prelude )
52
+ {
56
53
link_resolver. resolver . resolve_rustdoc_path ( extern_name, TypeNS , parent_scope) ;
57
54
}
58
55
@@ -73,7 +70,6 @@ fn doc_attrs<'a>(attrs: impl Iterator<Item = &'a ast::Attribute>) -> Attributes
73
70
74
71
struct EarlyDocLinkResolver < ' r , ' ra > {
75
72
resolver : & ' r mut Resolver < ' ra > ,
76
- sess : & ' r Session ,
77
73
parent_scope : ParentScope < ' ra > ,
78
74
visited_mods : DefIdSet ,
79
75
markdown_links : FxHashMap < String , Vec < PreprocessedMarkdownLink > > ,
@@ -166,7 +162,7 @@ impl<'ra> EarlyDocLinkResolver<'_, 'ra> {
166
162
fn resolve_doc_links_extern_impl ( & mut self , def_id : DefId , is_inherent : bool ) {
167
163
self . resolve_doc_links_extern_outer_fixme ( def_id, def_id) ;
168
164
let assoc_item_def_ids = Vec :: from_iter (
169
- self . resolver . cstore ( ) . associated_item_def_ids_untracked ( def_id, self . sess ) ,
165
+ self . resolver . cstore ( ) . associated_item_def_ids_untracked ( def_id, self . resolver . sess ( ) ) ,
170
166
) ;
171
167
for assoc_def_id in assoc_item_def_ids {
172
168
if !is_inherent || self . resolver . cstore ( ) . visibility_untracked ( assoc_def_id) . is_public ( )
@@ -191,7 +187,9 @@ impl<'ra> EarlyDocLinkResolver<'_, 'ra> {
191
187
if !self . resolver . cstore ( ) . may_have_doc_links_untracked ( def_id) {
192
188
return ;
193
189
}
194
- let attrs = Vec :: from_iter ( self . resolver . cstore ( ) . item_attrs_untracked ( def_id, self . sess ) ) ;
190
+ let attrs = Vec :: from_iter (
191
+ self . resolver . cstore ( ) . item_attrs_untracked ( def_id, self . resolver . sess ( ) ) ,
192
+ ) ;
195
193
let parent_scope = ParentScope :: module (
196
194
self . resolver . get_nearest_non_block_module (
197
195
self . resolver . opt_parent ( scope_id) . unwrap_or ( scope_id) ,
@@ -205,7 +203,9 @@ impl<'ra> EarlyDocLinkResolver<'_, 'ra> {
205
203
if !self . resolver . cstore ( ) . may_have_doc_links_untracked ( def_id) {
206
204
return ;
207
205
}
208
- let attrs = Vec :: from_iter ( self . resolver . cstore ( ) . item_attrs_untracked ( def_id, self . sess ) ) ;
206
+ let attrs = Vec :: from_iter (
207
+ self . resolver . cstore ( ) . item_attrs_untracked ( def_id, self . resolver . sess ( ) ) ,
208
+ ) ;
209
209
let parent_scope = ParentScope :: module ( self . resolver . expect_module ( def_id) , self . resolver ) ;
210
210
self . resolve_doc_links ( doc_attrs ( attrs. iter ( ) ) , parent_scope) ;
211
211
}
@@ -321,7 +321,7 @@ impl<'ra> EarlyDocLinkResolver<'_, 'ra> {
321
321
let field_def_ids = Vec :: from_iter (
322
322
self . resolver
323
323
. cstore ( )
324
- . associated_item_def_ids_untracked ( def_id, self . sess ) ,
324
+ . associated_item_def_ids_untracked ( def_id, self . resolver . sess ( ) ) ,
325
325
) ;
326
326
for field_def_id in field_def_ids {
327
327
self . resolve_doc_links_extern_outer ( field_def_id, scope_id) ;
0 commit comments