@@ -39,13 +39,16 @@ use crate::passes::Pass;
39
39
40
40
use super :: span_of_attrs;
41
41
42
+ mod early;
43
+ crate use early:: IntraLinkCrateLoader ;
44
+
42
45
crate const COLLECT_INTRA_DOC_LINKS : Pass = Pass {
43
46
name : "collect-intra-doc-links" ,
44
47
run : collect_intra_doc_links,
45
48
description : "resolves intra-doc links" ,
46
49
} ;
47
50
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 {
49
52
LinkCollector {
50
53
cx,
51
54
mod_ids : Vec :: new ( ) ,
@@ -68,7 +71,7 @@ impl<'a> From<ResolutionFailure<'a>> for ErrorKind<'a> {
68
71
}
69
72
70
73
#[ derive( Copy , Clone , Debug , Hash ) ]
71
- crate enum Res {
74
+ enum Res {
72
75
Def ( DefKind , DefId ) ,
73
76
Primitive ( PrimitiveType ) ,
74
77
}
@@ -134,7 +137,7 @@ impl TryFrom<ResolveRes> for Res {
134
137
135
138
/// A link failed to resolve.
136
139
#[ derive( Debug ) ]
137
- crate enum ResolutionFailure < ' a > {
140
+ enum ResolutionFailure < ' a > {
138
141
/// This resolved, but with the wrong namespace.
139
142
WrongNamespace {
140
143
/// What the link resolved to.
@@ -172,7 +175,7 @@ crate enum ResolutionFailure<'a> {
172
175
}
173
176
174
177
#[ derive( Debug ) ]
175
- crate enum MalformedGenerics {
178
+ enum MalformedGenerics {
176
179
/// This link has unbalanced angle brackets.
177
180
///
178
181
/// For example, `Vec<T` should trigger this, as should `Vec<T>>`.
@@ -224,7 +227,7 @@ impl ResolutionFailure<'a> {
224
227
}
225
228
}
226
229
227
- crate enum AnchorFailure {
230
+ enum AnchorFailure {
228
231
/// User error: `[std#x#y]` is not valid
229
232
MultipleAnchors ,
230
233
/// The anchor provided by the user conflicts with Rustdoc's generated anchor.
@@ -892,7 +895,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
892
895
}
893
896
}
894
897
895
- crate enum PreprocessingError < ' a > {
898
+ enum PreprocessingError < ' a > {
896
899
Anchor ( AnchorFailure ) ,
897
900
Disambiguator ( Range < usize > , String ) ,
898
901
Resolution ( ResolutionFailure < ' a > , String , Option < Disambiguator > ) ,
@@ -904,8 +907,8 @@ impl From<AnchorFailure> for PreprocessingError<'_> {
904
907
}
905
908
}
906
909
907
- crate struct PreprocessingInfo {
908
- crate path_str : String ,
910
+ struct PreprocessingInfo {
911
+ path_str : String ,
909
912
disambiguator : Option < Disambiguator > ,
910
913
extra_fragment : Option < String > ,
911
914
link_text : String ,
@@ -917,7 +920,7 @@ crate struct PreprocessingInfo {
917
920
/// - `Some(Ok)` if the link is valid
918
921
///
919
922
/// `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 > (
921
924
ori_link : & ' a MarkdownLink ,
922
925
) -> Option < Result < PreprocessingInfo , PreprocessingError < ' a > > > {
923
926
// [] is mostly likely not supposed to be a link
@@ -1494,7 +1497,7 @@ fn should_ignore_link(path_str: &str) -> bool {
1494
1497
1495
1498
#[ derive( Copy , Clone , Debug , PartialEq , Eq , Hash ) ]
1496
1499
/// Disambiguators for a link.
1497
- crate enum Disambiguator {
1500
+ enum Disambiguator {
1498
1501
/// `prim@`
1499
1502
///
1500
1503
/// This is buggy, see <https://github.com/rust-lang/rust/pull/77875#discussion_r503583103>
@@ -1523,7 +1526,7 @@ impl Disambiguator {
1523
1526
/// This returns `Ok(Some(...))` if a disambiguator was found,
1524
1527
/// `Ok(None)` if no disambiguator was found, or `Err(...)`
1525
1528
/// 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 > ) > {
1527
1530
use Disambiguator :: { Kind , Namespace as NS , Primitive } ;
1528
1531
1529
1532
if let Some ( idx) = link. find ( '@' ) {
0 commit comments