Skip to content

Commit c49da5b

Browse files
authored
Rollup merge of rust-lang#58100 - h-michael:librustdoc-2018, r=Centril
Transition librustdoc to Rust 2018 rust-lang#58099
2 parents 082c861 + 1fe87df commit c49da5b

36 files changed

+455
-424
lines changed

src/librustdoc/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
authors = ["The Rust Project Developers"]
33
name = "rustdoc"
44
version = "0.0.0"
5+
edition = "2018"
56

67
[lib]
78
name = "rustdoc"

src/librustdoc/clean/auto_trait.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,10 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
220220
}
221221
}
222222

223-
fn get_lifetime(&self, region: Region, names_map: &FxHashMap<String, Lifetime>) -> Lifetime {
223+
fn get_lifetime(
224+
&self, region: Region<'_>,
225+
names_map: &FxHashMap<String, Lifetime>
226+
) -> Lifetime {
224227
self.region_name(region)
225228
.map(|name| {
226229
names_map.get(&name).unwrap_or_else(|| {
@@ -231,7 +234,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
231234
.clone()
232235
}
233236

234-
fn region_name(&self, region: Region) -> Option<String> {
237+
fn region_name(&self, region: Region<'_>) -> Option<String> {
235238
match region {
236239
&ty::ReEarlyBound(r) => Some(r.name.to_string()),
237240
_ => None,
@@ -259,7 +262,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
259262
// we need to create the Generics.
260263
let mut finished: FxHashMap<_, Vec<_>> = Default::default();
261264

262-
let mut vid_map: FxHashMap<RegionTarget, RegionDeps> = Default::default();
265+
let mut vid_map: FxHashMap<RegionTarget<'_>, RegionDeps<'_>> = Default::default();
263266

264267
// Flattening is done in two parts. First, we insert all of the constraints
265268
// into a map. Each RegionTarget (either a RegionVid or a Region) maps
@@ -842,7 +845,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
842845
vec.sort_by_cached_key(|x| format!("{:?}", x))
843846
}
844847

845-
fn is_fn_ty(&self, tcx: &TyCtxt, ty: &Type) -> bool {
848+
fn is_fn_ty(&self, tcx: &TyCtxt<'_, '_, '_>, ty: &Type) -> bool {
846849
match &ty {
847850
&&Type::ResolvedPath { ref did, .. } => {
848851
*did == tcx.require_lang_item(lang_items::FnTraitLangItem)

src/librustdoc/clean/blanket_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc::ty::subst::Subst;
55
use rustc::infer::InferOk;
66
use syntax_pos::DUMMY_SP;
77

8-
use core::DocAccessLevels;
8+
use crate::core::DocAccessLevels;
99

1010
use super::*;
1111

src/librustdoc/clean/cfg.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use syntax::feature_gate::Features;
1414

1515
use syntax_pos::Span;
1616

17-
use html::escape::Escape;
17+
use crate::html::escape::Escape;
1818

1919
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, PartialEq, Eq, Hash)]
2020
pub enum Cfg {
@@ -261,7 +261,7 @@ impl ops::BitOr for Cfg {
261261
struct Html<'a>(&'a Cfg, bool);
262262

263263
fn write_with_opt_paren<T: fmt::Display>(
264-
fmt: &mut fmt::Formatter,
264+
fmt: &mut fmt::Formatter<'_>,
265265
has_paren: bool,
266266
obj: T,
267267
) -> fmt::Result {
@@ -277,7 +277,7 @@ fn write_with_opt_paren<T: fmt::Display>(
277277

278278

279279
impl<'a> fmt::Display for Html<'a> {
280-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
280+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
281281
match *self.0 {
282282
Cfg::Not(ref child) => match **child {
283283
Cfg::Any(ref sub_cfgs) => {

src/librustdoc/clean/def_ctor.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use core::DocContext;
1+
use crate::core::DocContext;
22

33
use super::*;
44

5-
pub fn get_def_from_def_id<F>(cx: &DocContext,
5+
pub fn get_def_from_def_id<F>(cx: &DocContext<'_, '_, '_>,
66
def_id: DefId,
77
callback: &F,
88
) -> Vec<Item>
@@ -38,7 +38,7 @@ where F: Fn(& dyn Fn(DefId) -> Def) -> Vec<Item> {
3838
}
3939
}
4040

41-
pub fn get_def_from_node_id<F>(cx: &DocContext,
41+
pub fn get_def_from_node_id<F>(cx: &DocContext<'_, '_, '_>,
4242
id: ast::NodeId,
4343
name: String,
4444
callback: &F,

src/librustdoc/clean/inline.rs

+31-22
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use rustc_metadata::cstore::LoadedMacro;
1313
use rustc::ty;
1414
use rustc::util::nodemap::FxHashSet;
1515

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::{
1919
self,
2020
GetDefId,
2121
ToSource,
@@ -35,7 +35,12 @@ use super::Clean;
3535
///
3636
/// The returned value is `None` if the definition could not be inlined,
3737
/// 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+
)
3944
-> Option<Vec<clean::Item>> {
4045
let did = if let Some(did) = def.opt_def_id() {
4146
did
@@ -124,7 +129,7 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name, visited: &mut FxHa
124129
Some(ret)
125130
}
126131

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>)
128133
-> Option<Vec<clean::Item>>
129134
{
130135
if def == Def::Err { return None }
@@ -141,15 +146,15 @@ pub fn try_inline_glob(cx: &DocContext, def: Def, visited: &mut FxHashSet<DefId>
141146
}
142147
}
143148

144-
pub fn load_attrs(cx: &DocContext, did: DefId) -> clean::Attributes {
149+
pub fn load_attrs(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Attributes {
145150
cx.tcx.get_attrs(did).clean(cx)
146151
}
147152

148153
/// Record an external fully qualified name in the external_paths cache.
149154
///
150155
/// These names are used later on by HTML rendering to generate things like
151156
/// 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) {
153158
let mut crate_name = cx.tcx.crate_name(did.krate).to_string();
154159
if did.is_local() {
155160
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) {
177182
}
178183
}
179184

180-
pub fn build_external_trait(cx: &DocContext, did: DefId) -> clean::Trait {
185+
pub fn build_external_trait(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Trait {
181186
let auto_trait = cx.tcx.trait_def(did).has_auto_impl;
182187
let trait_items = cx.tcx.associated_items(did).map(|item| item.clean(cx)).collect();
183188
let predicates = cx.tcx.predicates_of(did);
@@ -197,7 +202,7 @@ pub fn build_external_trait(cx: &DocContext, did: DefId) -> clean::Trait {
197202
}
198203
}
199204

200-
fn build_external_function(cx: &DocContext, did: DefId) -> clean::Function {
205+
fn build_external_function(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Function {
201206
let sig = cx.tcx.fn_sig(did);
202207

203208
let constness = if cx.tcx.is_min_const_fn(did) {
@@ -219,7 +224,7 @@ fn build_external_function(cx: &DocContext, did: DefId) -> clean::Function {
219224
}
220225
}
221226

222-
fn build_enum(cx: &DocContext, did: DefId) -> clean::Enum {
227+
fn build_enum(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Enum {
223228
let predicates = cx.tcx.predicates_of(did);
224229

225230
clean::Enum {
@@ -229,7 +234,7 @@ fn build_enum(cx: &DocContext, did: DefId) -> clean::Enum {
229234
}
230235
}
231236

232-
fn build_struct(cx: &DocContext, did: DefId) -> clean::Struct {
237+
fn build_struct(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Struct {
233238
let predicates = cx.tcx.predicates_of(did);
234239
let variant = cx.tcx.adt_def(did).non_enum_variant();
235240

@@ -245,7 +250,7 @@ fn build_struct(cx: &DocContext, did: DefId) -> clean::Struct {
245250
}
246251
}
247252

248-
fn build_union(cx: &DocContext, did: DefId) -> clean::Union {
253+
fn build_union(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Union {
249254
let predicates = cx.tcx.predicates_of(did);
250255
let variant = cx.tcx.adt_def(did).non_enum_variant();
251256

@@ -257,7 +262,7 @@ fn build_union(cx: &DocContext, did: DefId) -> clean::Union {
257262
}
258263
}
259264

260-
fn build_type_alias(cx: &DocContext, did: DefId) -> clean::Typedef {
265+
fn build_type_alias(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Typedef {
261266
let predicates = cx.tcx.predicates_of(did);
262267

263268
clean::Typedef {
@@ -266,7 +271,7 @@ fn build_type_alias(cx: &DocContext, did: DefId) -> clean::Typedef {
266271
}
267272
}
268273

269-
pub fn build_impls(cx: &DocContext, did: DefId) -> Vec<clean::Item> {
274+
pub fn build_impls(cx: &DocContext<'_, '_, '_>, did: DefId) -> Vec<clean::Item> {
270275
let tcx = cx.tcx;
271276
let mut impls = Vec::new();
272277

@@ -277,7 +282,7 @@ pub fn build_impls(cx: &DocContext, did: DefId) -> Vec<clean::Item> {
277282
impls
278283
}
279284

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>) {
281286
if !cx.renderinfo.borrow_mut().inlined.insert(did) {
282287
return
283288
}
@@ -387,15 +392,19 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec<clean::Item>) {
387392
});
388393
}
389394

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 {
391400
let mut items = Vec::new();
392401
fill_in(cx, did, &mut items, visited);
393402
return clean::Module {
394403
items,
395404
is_crate: false,
396405
};
397406

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>,
399408
visited: &mut FxHashSet<DefId>) {
400409
// If we're re-exporting a re-export it may actually re-export something in
401410
// 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>) ->
412421
}
413422
}
414423

415-
pub fn print_inlined_const(cx: &DocContext, did: DefId) -> String {
424+
pub fn print_inlined_const(cx: &DocContext<'_, '_, '_>, did: DefId) -> String {
416425
if let Some(node_id) = cx.tcx.hir().as_local_node_id(did) {
417426
cx.tcx.hir().node_to_pretty_string(node_id)
418427
} else {
419428
cx.tcx.rendered_const(did)
420429
}
421430
}
422431

423-
fn build_const(cx: &DocContext, did: DefId) -> clean::Constant {
432+
fn build_const(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Constant {
424433
clean::Constant {
425434
type_: cx.tcx.type_of(did).clean(cx),
426435
expr: print_inlined_const(cx, did)
427436
}
428437
}
429438

430-
fn build_static(cx: &DocContext, did: DefId, mutable: bool) -> clean::Static {
439+
fn build_static(cx: &DocContext<'_, '_, '_>, did: DefId, mutable: bool) -> clean::Static {
431440
clean::Static {
432441
type_: cx.tcx.type_of(did).clean(cx),
433442
mutability: if mutable {clean::Mutable} else {clean::Immutable},
434443
expr: "\n\n\n".to_string(), // trigger the "[definition]" links
435444
}
436445
}
437446

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 {
439448
let imported_from = cx.tcx.original_crate_name(did.krate);
440449
match cx.cstore.load_macro_untracked(did, cx.sess()) {
441450
LoadedMacro::MacroDef(def) => {
@@ -537,7 +546,7 @@ fn separate_supertrait_bounds(mut g: clean::Generics)
537546
(g, ty_bounds)
538547
}
539548

540-
pub fn record_extern_trait(cx: &DocContext, did: DefId) {
549+
pub fn record_extern_trait(cx: &DocContext<'_, '_, '_>, did: DefId) {
541550
if did.is_local() {
542551
return;
543552
}

0 commit comments

Comments
 (0)