@@ -13,9 +13,9 @@ use rustc_metadata::cstore::LoadedMacro;
13
13
use rustc:: ty;
14
14
use rustc:: util:: nodemap:: FxHashSet ;
15
15
16
- use core:: { DocContext , DocAccessLevels } ;
17
- use doctree;
18
- use clean:: {
16
+ use crate :: core:: { DocContext , DocAccessLevels } ;
17
+ use crate :: doctree;
18
+ use crate :: clean:: {
19
19
self ,
20
20
GetDefId ,
21
21
ToSource ,
@@ -35,7 +35,12 @@ use super::Clean;
35
35
///
36
36
/// The returned value is `None` if the definition could not be inlined,
37
37
/// and `Some` of a vector of items if it was successfully expanded.
38
- pub fn try_inline ( cx : & DocContext , def : Def , name : ast:: Name , visited : & mut FxHashSet < DefId > )
38
+ pub fn try_inline (
39
+ cx : & DocContext < ' _ , ' _ , ' _ > ,
40
+ def : Def ,
41
+ name : ast:: Name ,
42
+ visited : & mut FxHashSet < DefId >
43
+ )
39
44
-> Option < Vec < clean:: Item > > {
40
45
let did = if let Some ( did) = def. opt_def_id ( ) {
41
46
did
@@ -124,7 +129,7 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name, visited: &mut FxHa
124
129
Some ( ret)
125
130
}
126
131
127
- pub fn try_inline_glob ( cx : & DocContext , def : Def , visited : & mut FxHashSet < DefId > )
132
+ pub fn try_inline_glob ( cx : & DocContext < ' _ , ' _ , ' _ > , def : Def , visited : & mut FxHashSet < DefId > )
128
133
-> Option < Vec < clean:: Item > >
129
134
{
130
135
if def == Def :: Err { return None }
@@ -141,15 +146,15 @@ pub fn try_inline_glob(cx: &DocContext, def: Def, visited: &mut FxHashSet<DefId>
141
146
}
142
147
}
143
148
144
- pub fn load_attrs ( cx : & DocContext , did : DefId ) -> clean:: Attributes {
149
+ pub fn load_attrs ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId ) -> clean:: Attributes {
145
150
cx. tcx . get_attrs ( did) . clean ( cx)
146
151
}
147
152
148
153
/// Record an external fully qualified name in the external_paths cache.
149
154
///
150
155
/// These names are used later on by HTML rendering to generate things like
151
156
/// source links back to the original item.
152
- pub fn record_extern_fqn ( cx : & DocContext , did : DefId , kind : clean:: TypeKind ) {
157
+ pub fn record_extern_fqn ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId , kind : clean:: TypeKind ) {
153
158
let mut crate_name = cx. tcx . crate_name ( did. krate ) . to_string ( ) ;
154
159
if did. is_local ( ) {
155
160
crate_name = cx. crate_name . clone ( ) . unwrap_or ( crate_name) ;
@@ -177,7 +182,7 @@ pub fn record_extern_fqn(cx: &DocContext, did: DefId, kind: clean::TypeKind) {
177
182
}
178
183
}
179
184
180
- pub fn build_external_trait ( cx : & DocContext , did : DefId ) -> clean:: Trait {
185
+ pub fn build_external_trait ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId ) -> clean:: Trait {
181
186
let auto_trait = cx. tcx . trait_def ( did) . has_auto_impl ;
182
187
let trait_items = cx. tcx . associated_items ( did) . map ( |item| item. clean ( cx) ) . collect ( ) ;
183
188
let predicates = cx. tcx . predicates_of ( did) ;
@@ -197,7 +202,7 @@ pub fn build_external_trait(cx: &DocContext, did: DefId) -> clean::Trait {
197
202
}
198
203
}
199
204
200
- fn build_external_function ( cx : & DocContext , did : DefId ) -> clean:: Function {
205
+ fn build_external_function ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId ) -> clean:: Function {
201
206
let sig = cx. tcx . fn_sig ( did) ;
202
207
203
208
let constness = if cx. tcx . is_min_const_fn ( did) {
@@ -219,7 +224,7 @@ fn build_external_function(cx: &DocContext, did: DefId) -> clean::Function {
219
224
}
220
225
}
221
226
222
- fn build_enum ( cx : & DocContext , did : DefId ) -> clean:: Enum {
227
+ fn build_enum ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId ) -> clean:: Enum {
223
228
let predicates = cx. tcx . predicates_of ( did) ;
224
229
225
230
clean:: Enum {
@@ -229,7 +234,7 @@ fn build_enum(cx: &DocContext, did: DefId) -> clean::Enum {
229
234
}
230
235
}
231
236
232
- fn build_struct ( cx : & DocContext , did : DefId ) -> clean:: Struct {
237
+ fn build_struct ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId ) -> clean:: Struct {
233
238
let predicates = cx. tcx . predicates_of ( did) ;
234
239
let variant = cx. tcx . adt_def ( did) . non_enum_variant ( ) ;
235
240
@@ -245,7 +250,7 @@ fn build_struct(cx: &DocContext, did: DefId) -> clean::Struct {
245
250
}
246
251
}
247
252
248
- fn build_union ( cx : & DocContext , did : DefId ) -> clean:: Union {
253
+ fn build_union ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId ) -> clean:: Union {
249
254
let predicates = cx. tcx . predicates_of ( did) ;
250
255
let variant = cx. tcx . adt_def ( did) . non_enum_variant ( ) ;
251
256
@@ -257,7 +262,7 @@ fn build_union(cx: &DocContext, did: DefId) -> clean::Union {
257
262
}
258
263
}
259
264
260
- fn build_type_alias ( cx : & DocContext , did : DefId ) -> clean:: Typedef {
265
+ fn build_type_alias ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId ) -> clean:: Typedef {
261
266
let predicates = cx. tcx . predicates_of ( did) ;
262
267
263
268
clean:: Typedef {
@@ -266,7 +271,7 @@ fn build_type_alias(cx: &DocContext, did: DefId) -> clean::Typedef {
266
271
}
267
272
}
268
273
269
- pub fn build_impls ( cx : & DocContext , did : DefId ) -> Vec < clean:: Item > {
274
+ pub fn build_impls ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId ) -> Vec < clean:: Item > {
270
275
let tcx = cx. tcx ;
271
276
let mut impls = Vec :: new ( ) ;
272
277
@@ -277,7 +282,7 @@ pub fn build_impls(cx: &DocContext, did: DefId) -> Vec<clean::Item> {
277
282
impls
278
283
}
279
284
280
- pub fn build_impl ( cx : & DocContext , did : DefId , ret : & mut Vec < clean:: Item > ) {
285
+ pub fn build_impl ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId , ret : & mut Vec < clean:: Item > ) {
281
286
if !cx. renderinfo . borrow_mut ( ) . inlined . insert ( did) {
282
287
return
283
288
}
@@ -387,15 +392,19 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec<clean::Item>) {
387
392
} ) ;
388
393
}
389
394
390
- fn build_module ( cx : & DocContext , did : DefId , visited : & mut FxHashSet < DefId > ) -> clean:: Module {
395
+ fn build_module (
396
+ cx : & DocContext < ' _ , ' _ , ' _ > ,
397
+ did : DefId ,
398
+ visited : & mut FxHashSet < DefId >
399
+ ) -> clean:: Module {
391
400
let mut items = Vec :: new ( ) ;
392
401
fill_in ( cx, did, & mut items, visited) ;
393
402
return clean:: Module {
394
403
items,
395
404
is_crate : false ,
396
405
} ;
397
406
398
- fn fill_in ( cx : & DocContext , did : DefId , items : & mut Vec < clean:: Item > ,
407
+ fn fill_in ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId , items : & mut Vec < clean:: Item > ,
399
408
visited : & mut FxHashSet < DefId > ) {
400
409
// If we're re-exporting a re-export it may actually re-export something in
401
410
// two namespaces, so the target may be listed twice. Make sure we only
@@ -412,30 +421,30 @@ fn build_module(cx: &DocContext, did: DefId, visited: &mut FxHashSet<DefId>) ->
412
421
}
413
422
}
414
423
415
- pub fn print_inlined_const ( cx : & DocContext , did : DefId ) -> String {
424
+ pub fn print_inlined_const ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId ) -> String {
416
425
if let Some ( node_id) = cx. tcx . hir ( ) . as_local_node_id ( did) {
417
426
cx. tcx . hir ( ) . node_to_pretty_string ( node_id)
418
427
} else {
419
428
cx. tcx . rendered_const ( did)
420
429
}
421
430
}
422
431
423
- fn build_const ( cx : & DocContext , did : DefId ) -> clean:: Constant {
432
+ fn build_const ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId ) -> clean:: Constant {
424
433
clean:: Constant {
425
434
type_ : cx. tcx . type_of ( did) . clean ( cx) ,
426
435
expr : print_inlined_const ( cx, did)
427
436
}
428
437
}
429
438
430
- fn build_static ( cx : & DocContext , did : DefId , mutable : bool ) -> clean:: Static {
439
+ fn build_static ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId , mutable : bool ) -> clean:: Static {
431
440
clean:: Static {
432
441
type_ : cx. tcx . type_of ( did) . clean ( cx) ,
433
442
mutability : if mutable { clean:: Mutable } else { clean:: Immutable } ,
434
443
expr : "\n \n \n " . to_string ( ) , // trigger the "[definition]" links
435
444
}
436
445
}
437
446
438
- fn build_macro ( cx : & DocContext , did : DefId , name : ast:: Name ) -> clean:: ItemEnum {
447
+ fn build_macro ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId , name : ast:: Name ) -> clean:: ItemEnum {
439
448
let imported_from = cx. tcx . original_crate_name ( did. krate ) ;
440
449
match cx. cstore . load_macro_untracked ( did, cx. sess ( ) ) {
441
450
LoadedMacro :: MacroDef ( def) => {
@@ -537,7 +546,7 @@ fn separate_supertrait_bounds(mut g: clean::Generics)
537
546
( g, ty_bounds)
538
547
}
539
548
540
- pub fn record_extern_trait ( cx : & DocContext , did : DefId ) {
549
+ pub fn record_extern_trait ( cx : & DocContext < ' _ , ' _ , ' _ > , did : DefId ) {
541
550
if did. is_local ( ) {
542
551
return ;
543
552
}
0 commit comments