@@ -12,8 +12,6 @@ use rustc_hir::def_id::{DefId, DefIdMap, DefIdSet, CRATE_DEF_ID};
1212use rustc_hir:: TraitCandidate ;
1313use rustc_middle:: ty:: { DefIdTree , Visibility } ;
1414use rustc_resolve:: { ParentScope , Resolver } ;
15- use rustc_session:: config:: Externs ;
16- use rustc_session:: Session ;
1715use rustc_span:: symbol:: sym;
1816use rustc_span:: { Symbol , SyntaxContext } ;
1917
@@ -22,16 +20,13 @@ use std::mem;
2220
2321pub ( crate ) fn early_resolve_intra_doc_links (
2422 resolver : & mut Resolver < ' _ > ,
25- sess : & Session ,
2623 krate : & ast:: Crate ,
27- externs : Externs ,
2824 document_private_items : bool ,
2925) -> ResolverCaches {
3026 let parent_scope =
3127 ParentScope :: module ( resolver. expect_module ( CRATE_DEF_ID . to_def_id ( ) ) , resolver) ;
3228 let mut link_resolver = EarlyDocLinkResolver {
3329 resolver,
34- sess,
3530 parent_scope,
3631 visited_mods : Default :: default ( ) ,
3732 markdown_links : Default :: default ( ) ,
@@ -52,7 +47,9 @@ pub(crate) fn early_resolve_intra_doc_links(
5247 // the known necessary crates. Load them all unconditionally until we find a way to fix this.
5348 // DO NOT REMOVE THIS without first testing on the reproducer in
5449 // 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+ {
5653 link_resolver. resolver . resolve_rustdoc_path ( extern_name, TypeNS , parent_scope) ;
5754 }
5855
@@ -73,7 +70,6 @@ fn doc_attrs<'a>(attrs: impl Iterator<Item = &'a ast::Attribute>) -> Attributes
7370
7471struct EarlyDocLinkResolver < ' r , ' ra > {
7572 resolver : & ' r mut Resolver < ' ra > ,
76- sess : & ' r Session ,
7773 parent_scope : ParentScope < ' ra > ,
7874 visited_mods : DefIdSet ,
7975 markdown_links : FxHashMap < String , Vec < PreprocessedMarkdownLink > > ,
@@ -166,7 +162,7 @@ impl<'ra> EarlyDocLinkResolver<'_, 'ra> {
166162 fn resolve_doc_links_extern_impl ( & mut self , def_id : DefId , is_inherent : bool ) {
167163 self . resolve_doc_links_extern_outer_fixme ( def_id, def_id) ;
168164 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 ( ) ) ,
170166 ) ;
171167 for assoc_def_id in assoc_item_def_ids {
172168 if !is_inherent || self . resolver . cstore ( ) . visibility_untracked ( assoc_def_id) . is_public ( )
@@ -191,7 +187,9 @@ impl<'ra> EarlyDocLinkResolver<'_, 'ra> {
191187 if !self . resolver . cstore ( ) . may_have_doc_links_untracked ( def_id) {
192188 return ;
193189 }
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+ ) ;
195193 let parent_scope = ParentScope :: module (
196194 self . resolver . get_nearest_non_block_module (
197195 self . resolver . opt_parent ( scope_id) . unwrap_or ( scope_id) ,
@@ -205,7 +203,9 @@ impl<'ra> EarlyDocLinkResolver<'_, 'ra> {
205203 if !self . resolver . cstore ( ) . may_have_doc_links_untracked ( def_id) {
206204 return ;
207205 }
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+ ) ;
209209 let parent_scope = ParentScope :: module ( self . resolver . expect_module ( def_id) , self . resolver ) ;
210210 self . resolve_doc_links ( doc_attrs ( attrs. iter ( ) ) , parent_scope) ;
211211 }
@@ -321,7 +321,7 @@ impl<'ra> EarlyDocLinkResolver<'_, 'ra> {
321321 let field_def_ids = Vec :: from_iter (
322322 self . resolver
323323 . cstore ( )
324- . associated_item_def_ids_untracked ( def_id, self . sess ) ,
324+ . associated_item_def_ids_untracked ( def_id, self . resolver . sess ( ) ) ,
325325 ) ;
326326 for field_def_id in field_def_ids {
327327 self . resolve_doc_links_extern_outer ( field_def_id, scope_id) ;
0 commit comments