@@ -105,15 +105,15 @@ pub fn krate(mut cx: &mut DocContext<'_>) -> Crate {
105
105
}
106
106
107
107
// extract the stability index for a node from tcx, if possible
108
- fn get_stability ( cx : & DocContext < ' _ > , def_id : DefId ) -> Option < Stability > {
108
+ pub fn get_stability ( cx : & DocContext < ' _ > , def_id : DefId ) -> Option < Stability > {
109
109
cx. tcx . lookup_stability ( def_id) . clean ( cx)
110
110
}
111
111
112
- fn get_deprecation ( cx : & DocContext < ' _ > , def_id : DefId ) -> Option < Deprecation > {
112
+ pub fn get_deprecation ( cx : & DocContext < ' _ > , def_id : DefId ) -> Option < Deprecation > {
113
113
cx. tcx . lookup_deprecation ( def_id) . clean ( cx)
114
114
}
115
115
116
- fn external_generic_args (
116
+ pub fn external_generic_args (
117
117
cx : & DocContext < ' _ > ,
118
118
trait_did : Option < DefId > ,
119
119
has_self : bool ,
@@ -161,8 +161,8 @@ fn external_generic_args(
161
161
162
162
// trait_did should be set to a trait's DefId if called on a TraitRef, in order to sugar
163
163
// from Fn<(A, B,), C> to Fn(A, B) -> C
164
- fn external_path ( cx : & DocContext < ' _ > , name : Symbol , trait_did : Option < DefId > , has_self : bool ,
165
- bindings : Vec < TypeBinding > , substs : SubstsRef < ' _ > ) -> Path {
164
+ pub fn external_path ( cx : & DocContext < ' _ > , name : Symbol , trait_did : Option < DefId > , has_self : bool ,
165
+ bindings : Vec < TypeBinding > , substs : SubstsRef < ' _ > ) -> Path {
166
166
Path {
167
167
global : false ,
168
168
res : Res :: Err ,
@@ -178,7 +178,7 @@ fn external_path(cx: &DocContext<'_>, name: Symbol, trait_did: Option<DefId>, ha
178
178
/// i.e. `[T, U]` when you have the following bounds: `T: Display, U: Option<T>` will return
179
179
/// `[Display, Option]` (we just returns the list of the types, we don't care about the
180
180
/// wrapped types in here).
181
- fn get_real_types (
181
+ pub fn get_real_types (
182
182
generics : & Generics ,
183
183
arg : & Type ,
184
184
cx : & DocContext < ' _ > ,
@@ -285,7 +285,7 @@ pub fn get_all_types(
285
285
( all_types. into_iter ( ) . collect ( ) , ret_types)
286
286
}
287
287
288
- fn strip_type ( ty : Type ) -> Type {
288
+ pub fn strip_type ( ty : Type ) -> Type {
289
289
match ty {
290
290
Type :: ResolvedPath { path, param_names, did, is_generic } => {
291
291
Type :: ResolvedPath { path : strip_path ( & path) , param_names, did, is_generic }
@@ -309,7 +309,7 @@ fn strip_type(ty: Type) -> Type {
309
309
}
310
310
}
311
311
312
- fn strip_path ( path : & Path ) -> Path {
312
+ pub fn strip_path ( path : & Path ) -> Path {
313
313
let segments = path. segments . iter ( ) . map ( |s| {
314
314
PathSegment {
315
315
name : s. name . clone ( ) ,
@@ -327,7 +327,7 @@ fn strip_path(path: &Path) -> Path {
327
327
}
328
328
}
329
329
330
- fn qpath_to_string ( p : & hir:: QPath ) -> String {
330
+ pub fn qpath_to_string ( p : & hir:: QPath ) -> String {
331
331
let segments = match * p {
332
332
hir:: QPath :: Resolved ( _, ref path) => & path. segments ,
333
333
hir:: QPath :: TypeRelative ( _, ref segment) => return segment. ident . to_string ( ) ,
@@ -345,9 +345,9 @@ fn qpath_to_string(p: &hir::QPath) -> String {
345
345
s
346
346
}
347
347
348
- fn build_deref_target_impls ( cx : & DocContext < ' _ > ,
349
- items : & [ Item ] ,
350
- ret : & mut Vec < Item > ) {
348
+ pub fn build_deref_target_impls ( cx : & DocContext < ' _ > ,
349
+ items : & [ Item ] ,
350
+ ret : & mut Vec < Item > ) {
351
351
use self :: PrimitiveType :: * ;
352
352
let tcx = cx. tcx ;
353
353
@@ -420,7 +420,7 @@ impl ToSource for syntax_pos::Span {
420
420
}
421
421
}
422
422
423
- fn name_from_pat ( p : & hir:: Pat ) -> String {
423
+ pub fn name_from_pat ( p : & hir:: Pat ) -> String {
424
424
use rustc:: hir:: * ;
425
425
debug ! ( "trying to get a name from pattern: {:?}" , p) ;
426
426
@@ -458,7 +458,7 @@ fn name_from_pat(p: &hir::Pat) -> String {
458
458
}
459
459
}
460
460
461
- fn print_const ( cx : & DocContext < ' _ > , n : & ty:: Const < ' _ > ) -> String {
461
+ pub fn print_const ( cx : & DocContext < ' _ > , n : & ty:: Const < ' _ > ) -> String {
462
462
match n. val {
463
463
ty:: ConstKind :: Unevaluated ( def_id, _) => {
464
464
if let Some ( hir_id) = cx. tcx . hir ( ) . as_local_hir_id ( def_id) {
@@ -483,14 +483,14 @@ fn print_const(cx: &DocContext<'_>, n: &ty::Const<'_>) -> String {
483
483
}
484
484
}
485
485
486
- fn print_const_expr ( cx : & DocContext < ' _ > , body : hir:: BodyId ) -> String {
486
+ pub fn print_const_expr ( cx : & DocContext < ' _ > , body : hir:: BodyId ) -> String {
487
487
cx. tcx . hir ( ) . hir_to_pretty_string ( body. hir_id )
488
488
}
489
489
490
490
/// Given a type Path, resolve it to a Type using the TyCtxt
491
- fn resolve_type ( cx : & DocContext < ' _ > ,
492
- path : Path ,
493
- id : hir:: HirId ) -> Type {
491
+ pub fn resolve_type ( cx : & DocContext < ' _ > ,
492
+ path : Path ,
493
+ id : hir:: HirId ) -> Type {
494
494
if id == hir:: DUMMY_HIR_ID {
495
495
debug ! ( "resolve_type({:?})" , path) ;
496
496
} else {
@@ -564,7 +564,7 @@ pub fn register_res(cx: &DocContext<'_>, res: Res) -> DefId {
564
564
did
565
565
}
566
566
567
- fn resolve_use_source ( cx : & DocContext < ' _ > , path : Path ) -> ImportSource {
567
+ pub fn resolve_use_source ( cx : & DocContext < ' _ > , path : Path ) -> ImportSource {
568
568
ImportSource {
569
569
did : if path. res . opt_def_id ( ) . is_none ( ) {
570
570
None
0 commit comments