1
Fork 0

remove in_band_lifetimes from librustdoc

This commit is contained in:
Michael Goulet 2021-12-28 14:27:31 -08:00
parent 51e8031e14
commit bc7968f961
9 changed files with 19 additions and 20 deletions

View file

@ -148,7 +148,7 @@ fn clean_trait_ref_with_bindings(
path path
} }
impl Clean<Path> for ty::TraitRef<'tcx> { impl Clean<Path> for ty::TraitRef<'_> {
fn clean(&self, cx: &mut DocContext<'_>) -> Path { fn clean(&self, cx: &mut DocContext<'_>) -> Path {
clean_trait_ref_with_bindings(cx, *self, &[]) clean_trait_ref_with_bindings(cx, *self, &[])
} }
@ -549,7 +549,7 @@ impl Clean<Generics> for hir::Generics<'_> {
fn clean_ty_generics( fn clean_ty_generics(
cx: &mut DocContext<'_>, cx: &mut DocContext<'_>,
gens: &ty::Generics, gens: &ty::Generics,
preds: ty::GenericPredicates<'tcx>, preds: ty::GenericPredicates<'_>,
) -> Generics { ) -> Generics {
// Don't populate `cx.impl_trait_bounds` before `clean`ning `where` clauses, // Don't populate `cx.impl_trait_bounds` before `clean`ning `where` clauses,
// since `Clean for ty::Predicate` would consume them. // since `Clean for ty::Predicate` would consume them.
@ -579,7 +579,7 @@ fn clean_ty_generics(
.collect::<Vec<GenericParamDef>>(); .collect::<Vec<GenericParamDef>>();
// param index -> [(DefId of trait, associated type name, type)] // param index -> [(DefId of trait, associated type name, type)]
let mut impl_trait_proj = FxHashMap::<u32, Vec<(DefId, Symbol, Ty<'tcx>)>>::default(); let mut impl_trait_proj = FxHashMap::<u32, Vec<(DefId, Symbol, Ty<'_>)>>::default();
let where_predicates = preds let where_predicates = preds
.predicates .predicates
@ -708,8 +708,8 @@ fn clean_ty_generics(
fn clean_fn_or_proc_macro( fn clean_fn_or_proc_macro(
item: &hir::Item<'_>, item: &hir::Item<'_>,
sig: &'a hir::FnSig<'a>, sig: &hir::FnSig<'_>,
generics: &'a hir::Generics<'a>, generics: &hir::Generics<'_>,
body_id: hir::BodyId, body_id: hir::BodyId,
name: &mut Symbol, name: &mut Symbol,
cx: &mut DocContext<'_>, cx: &mut DocContext<'_>,
@ -1387,7 +1387,7 @@ impl Clean<Type> for hir::Ty<'_> {
} }
/// Returns `None` if the type could not be normalized /// Returns `None` if the type could not be normalized
fn normalize(cx: &mut DocContext<'tcx>, ty: Ty<'_>) -> Option<Ty<'tcx>> { fn normalize<'tcx>(cx: &mut DocContext<'tcx>, ty: Ty<'_>) -> Option<Ty<'tcx>> {
// HACK: low-churn fix for #79459 while we wait for a trait normalization fix // HACK: low-churn fix for #79459 while we wait for a trait normalization fix
if !cx.tcx.sess.opts.debugging_opts.normalize_docs { if !cx.tcx.sess.opts.debugging_opts.normalize_docs {
return None; return None;

View file

@ -223,7 +223,7 @@ crate fn name_from_pat(p: &hir::Pat<'_>) -> Symbol {
}) })
} }
crate fn print_const(cx: &DocContext<'_>, n: &'tcx ty::Const<'_>) -> String { crate fn print_const(cx: &DocContext<'_>, n: &ty::Const<'_>) -> String {
match n.val { match n.val {
ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs_: _, promoted }) => { ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs_: _, promoted }) => {
let mut s = if let Some(def) = def.as_local() { let mut s = if let Some(def) = def.as_local() {
@ -294,7 +294,7 @@ fn format_integer_with_underscore_sep(num: &str) -> String {
.collect() .collect()
} }
fn print_const_with_custom_print_scalar(tcx: TyCtxt<'_>, ct: &'tcx ty::Const<'tcx>) -> String { fn print_const_with_custom_print_scalar(tcx: TyCtxt<'_>, ct: &ty::Const<'_>) -> String {
// Use a slightly different format for integer types which always shows the actual value. // Use a slightly different format for integer types which always shows the actual value.
// For all other types, fallback to the original `pretty_print_const`. // For all other types, fallback to the original `pretty_print_const`.
match (ct.val, ct.ty.kind()) { match (ct.val, ct.ty.kind()) {
@ -362,7 +362,7 @@ crate fn resolve_type(cx: &mut DocContext<'_>, path: Path) -> Type {
} }
crate fn get_auto_trait_and_blanket_impls( crate fn get_auto_trait_and_blanket_impls(
cx: &mut DocContext<'tcx>, cx: &mut DocContext<'_>,
item_def_id: DefId, item_def_id: DefId,
) -> impl Iterator<Item = Item> { ) -> impl Iterator<Item = Item> {
let auto_impls = cx let auto_impls = cx

View file

@ -187,7 +187,7 @@ struct TokenIter<'a> {
src: &'a str, src: &'a str,
} }
impl Iterator for TokenIter<'a> { impl<'a> Iterator for TokenIter<'a> {
type Item = (TokenKind, &'a str); type Item = (TokenKind, &'a str);
fn next(&mut self) -> Option<(TokenKind, &'a str)> { fn next(&mut self) -> Option<(TokenKind, &'a str)> {
if self.src.is_empty() { if self.src.is_empty() {
@ -227,7 +227,7 @@ struct PeekIter<'a> {
iter: TokenIter<'a>, iter: TokenIter<'a>,
} }
impl PeekIter<'a> { impl<'a> PeekIter<'a> {
fn new(iter: TokenIter<'a>) -> Self { fn new(iter: TokenIter<'a>) -> Self {
Self { stored: VecDeque::new(), peek_pos: 0, iter } Self { stored: VecDeque::new(), peek_pos: 0, iter }
} }
@ -254,7 +254,7 @@ impl PeekIter<'a> {
} }
} }
impl Iterator for PeekIter<'a> { impl<'a> Iterator for PeekIter<'a> {
type Item = (TokenKind, &'a str); type Item = (TokenKind, &'a str);
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
self.peek_pos = 0; self.peek_pos = 0;

View file

@ -92,7 +92,7 @@ impl<'tcx> SpanMapVisitor<'tcx> {
} }
} }
impl Visitor<'tcx> for SpanMapVisitor<'tcx> { impl<'tcx> Visitor<'tcx> for SpanMapVisitor<'tcx> {
type Map = rustc_middle::hir::map::Map<'tcx>; type Map = rustc_middle::hir::map::Map<'tcx>;
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> { fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {

View file

@ -142,7 +142,7 @@ impl DocVisitor for SourceCollector<'_, '_> {
} }
} }
impl SourceCollector<'_, 'tcx> { impl SourceCollector<'_, '_> {
/// Renders the given filename into its corresponding HTML source file. /// Renders the given filename into its corresponding HTML source file.
fn emit_source( fn emit_source(
&mut self, &mut self,

View file

@ -38,7 +38,7 @@ crate struct JsonRenderer<'tcx> {
cache: Rc<Cache>, cache: Rc<Cache>,
} }
impl JsonRenderer<'tcx> { impl<'tcx> JsonRenderer<'tcx> {
fn sess(&self) -> &'tcx Session { fn sess(&self) -> &'tcx Session {
self.tcx.sess self.tcx.sess
} }

View file

@ -8,7 +8,6 @@
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(control_flow_enum)] #![feature(control_flow_enum)]
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(in_band_lifetimes)]
#![feature(let_else)] #![feature(let_else)]
#![feature(nll)] #![feature(nll)]
#![feature(test)] #![feature(test)]

View file

@ -210,7 +210,7 @@ enum MalformedGenerics {
EmptyAngleBrackets, EmptyAngleBrackets,
} }
impl ResolutionFailure<'a> { impl ResolutionFailure<'_> {
/// This resolved fully (not just partially) but is erroneous for some other reason /// This resolved fully (not just partially) but is erroneous for some other reason
/// ///
/// Returns the full resolution of the link, if present. /// Returns the full resolution of the link, if present.
@ -283,7 +283,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
/// full path segments left in the link. /// full path segments left in the link.
/// ///
/// [enum struct variant]: hir::VariantData::Struct /// [enum struct variant]: hir::VariantData::Struct
fn variant_field( fn variant_field<'path>(
&self, &self,
path_str: &'path str, path_str: &'path str,
module_id: DefId, module_id: DefId,

View file

@ -32,8 +32,8 @@ crate struct Module<'hir> {
crate foreigns: Vec<(&'hir hir::ForeignItem<'hir>, Option<Symbol>)>, crate foreigns: Vec<(&'hir hir::ForeignItem<'hir>, Option<Symbol>)>,
} }
impl Module<'hir> { impl Module<'_> {
crate fn new(name: Symbol, id: hir::HirId, where_inner: Span) -> Module<'hir> { crate fn new(name: Symbol, id: hir::HirId, where_inner: Span) -> Self {
Module { name, id, where_inner, mods: Vec::new(), items: Vec::new(), foreigns: Vec::new() } Module { name, id, where_inner, mods: Vec::new(), items: Vec::new(), foreigns: Vec::new() }
} }