@@ -39,13 +39,16 @@ use crate::passes::Pass;
3939
4040use super :: span_of_attrs;
4141
42+ mod early;
43+ crate use early:: IntraLinkCrateLoader ;
44+
4245crate const COLLECT_INTRA_DOC_LINKS : Pass = Pass {
4346 name : "collect-intra-doc-links" ,
4447 run : collect_intra_doc_links,
4548 description : "resolves intra-doc links" ,
4649} ;
4750
48- crate fn collect_intra_doc_links ( krate : Crate , cx : & mut DocContext < ' _ > ) -> Crate {
51+ fn collect_intra_doc_links ( krate : Crate , cx : & mut DocContext < ' _ > ) -> Crate {
4952 LinkCollector {
5053 cx,
5154 mod_ids : Vec :: new ( ) ,
@@ -68,7 +71,7 @@ impl<'a> From<ResolutionFailure<'a>> for ErrorKind<'a> {
6871}
6972
7073#[ derive( Copy , Clone , Debug , Hash ) ]
71- crate enum Res {
74+ enum Res {
7275 Def ( DefKind , DefId ) ,
7376 Primitive ( PrimitiveType ) ,
7477}
@@ -134,7 +137,7 @@ impl TryFrom<ResolveRes> for Res {
134137
135138/// A link failed to resolve.
136139#[ derive( Debug ) ]
137- crate enum ResolutionFailure < ' a > {
140+ enum ResolutionFailure < ' a > {
138141 /// This resolved, but with the wrong namespace.
139142 WrongNamespace {
140143 /// What the link resolved to.
@@ -172,7 +175,7 @@ crate enum ResolutionFailure<'a> {
172175}
173176
174177#[ derive( Debug ) ]
175- crate enum MalformedGenerics {
178+ enum MalformedGenerics {
176179 /// This link has unbalanced angle brackets.
177180 ///
178181 /// For example, `Vec<T` should trigger this, as should `Vec<T>>`.
@@ -224,7 +227,7 @@ impl ResolutionFailure<'a> {
224227 }
225228}
226229
227- crate enum AnchorFailure {
230+ enum AnchorFailure {
228231 /// User error: `[std#x#y]` is not valid
229232 MultipleAnchors ,
230233 /// The anchor provided by the user conflicts with Rustdoc's generated anchor.
@@ -892,7 +895,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
892895 }
893896}
894897
895- crate enum PreprocessingError < ' a > {
898+ enum PreprocessingError < ' a > {
896899 Anchor ( AnchorFailure ) ,
897900 Disambiguator ( Range < usize > , String ) ,
898901 Resolution ( ResolutionFailure < ' a > , String , Option < Disambiguator > ) ,
@@ -904,8 +907,8 @@ impl From<AnchorFailure> for PreprocessingError<'_> {
904907 }
905908}
906909
907- crate struct PreprocessingInfo {
908- crate path_str : String ,
910+ struct PreprocessingInfo {
911+ path_str : String ,
909912 disambiguator : Option < Disambiguator > ,
910913 extra_fragment : Option < String > ,
911914 link_text : String ,
@@ -917,7 +920,7 @@ crate struct PreprocessingInfo {
917920/// - `Some(Ok)` if the link is valid
918921///
919922/// `link_buffer` is needed for lifetime reasons; it will always be overwritten and the contents ignored.
920- crate fn preprocess_link < ' a > (
923+ fn preprocess_link < ' a > (
921924 ori_link : & ' a MarkdownLink ,
922925) -> Option < Result < PreprocessingInfo , PreprocessingError < ' a > > > {
923926 // [] is mostly likely not supposed to be a link
@@ -1494,7 +1497,7 @@ fn should_ignore_link(path_str: &str) -> bool {
14941497
14951498#[ derive( Copy , Clone , Debug , PartialEq , Eq , Hash ) ]
14961499/// Disambiguators for a link.
1497- crate enum Disambiguator {
1500+ enum Disambiguator {
14981501 /// `prim@`
14991502 ///
15001503 /// This is buggy, see <https://github.com/rust-lang/rust/pull/77875#discussion_r503583103>
@@ -1523,7 +1526,7 @@ impl Disambiguator {
15231526 /// This returns `Ok(Some(...))` if a disambiguator was found,
15241527 /// `Ok(None)` if no disambiguator was found, or `Err(...)`
15251528 /// if there was a problem with the disambiguator.
1526- crate fn from_str ( link : & str ) -> Result < Option < ( Self , & str ) > , ( String , Range < usize > ) > {
1529+ fn from_str ( link : & str ) -> Result < Option < ( Self , & str ) > , ( String , Range < usize > ) > {
15271530 use Disambiguator :: { Kind , Namespace as NS , Primitive } ;
15281531
15291532 if let Some ( idx) = link. find ( '@' ) {
0 commit comments