mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 06:22:00 +00:00
Rollup merge of #56663 - Zoxc:resolver-lifetime, r=pnkfelix
Remove lifetime from Resolver
This commit is contained in:
commit
d3f6d61fe1
@ -730,9 +730,9 @@ pub struct ExpansionResult {
|
||||
pub hir_forest: hir_map::Forest,
|
||||
}
|
||||
|
||||
pub struct InnerExpansionResult<'a, 'b: 'a> {
|
||||
pub struct InnerExpansionResult<'a> {
|
||||
pub expanded_crate: ast::Crate,
|
||||
pub resolver: Resolver<'a, 'b>,
|
||||
pub resolver: Resolver<'a>,
|
||||
pub hir_forest: hir_map::Forest,
|
||||
}
|
||||
|
||||
@ -811,7 +811,7 @@ where
|
||||
|
||||
/// Same as phase_2_configure_and_expand, but doesn't let you keep the resolver
|
||||
/// around
|
||||
pub fn phase_2_configure_and_expand_inner<'a, 'b: 'a, F>(
|
||||
pub fn phase_2_configure_and_expand_inner<'a, F>(
|
||||
sess: &'a Session,
|
||||
cstore: &'a CStore,
|
||||
mut krate: ast::Crate,
|
||||
@ -820,9 +820,9 @@ pub fn phase_2_configure_and_expand_inner<'a, 'b: 'a, F>(
|
||||
addl_plugins: Option<Vec<String>>,
|
||||
make_glob_map: MakeGlobMap,
|
||||
resolver_arenas: &'a ResolverArenas<'a>,
|
||||
crate_loader: &'a mut CrateLoader<'b>,
|
||||
crate_loader: &'a mut CrateLoader<'a>,
|
||||
after_expand: F,
|
||||
) -> Result<InnerExpansionResult<'a, 'b>, CompileIncomplete>
|
||||
) -> Result<InnerExpansionResult<'a>, CompileIncomplete>
|
||||
where
|
||||
F: FnOnce(&ast::Crate) -> CompileResult,
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ impl<'a> ToNameBinding<'a> for (Def, ty::Visibility, Span, Mark, IsMacroExport)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'cl> Resolver<'a, 'cl> {
|
||||
impl<'a> Resolver<'a> {
|
||||
/// Defines `name` in namespace `ns` of module `parent` to be `def` if it is not yet defined;
|
||||
/// otherwise, reports an error.
|
||||
pub fn define<T>(&mut self, parent: Module<'a>, ident: Ident, ns: Namespace, def: T)
|
||||
@ -888,13 +888,13 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BuildReducedGraphVisitor<'a, 'b: 'a, 'c: 'b> {
|
||||
pub resolver: &'a mut Resolver<'b, 'c>,
|
||||
pub struct BuildReducedGraphVisitor<'a, 'b: 'a> {
|
||||
pub resolver: &'a mut Resolver<'b>,
|
||||
pub current_legacy_scope: LegacyScope<'b>,
|
||||
pub expansion: Mark,
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'cl> BuildReducedGraphVisitor<'a, 'b, 'cl> {
|
||||
impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
||||
fn visit_invoc(&mut self, id: ast::NodeId) -> &'b InvocationData<'b> {
|
||||
let mark = id.placeholder_to_mark();
|
||||
self.resolver.current_module.unresolved_invocations.borrow_mut().insert(mark);
|
||||
@ -917,7 +917,7 @@ macro_rules! method {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'cl> Visitor<'a> for BuildReducedGraphVisitor<'a, 'b, 'cl> {
|
||||
impl<'a, 'b> Visitor<'a> for BuildReducedGraphVisitor<'a, 'b> {
|
||||
method!(visit_impl_item: ast::ImplItem, ast::ImplItemKind::Macro, walk_impl_item);
|
||||
method!(visit_expr: ast::Expr, ast::ExprKind::Mac, walk_expr);
|
||||
method!(visit_pat: ast::Pat, ast::PatKind::Mac, walk_pat);
|
||||
|
@ -31,8 +31,8 @@ use syntax::visit::{self, Visitor};
|
||||
use syntax_pos::{Span, MultiSpan, DUMMY_SP};
|
||||
|
||||
|
||||
struct UnusedImportCheckVisitor<'a, 'b: 'a, 'd: 'b> {
|
||||
resolver: &'a mut Resolver<'b, 'd>,
|
||||
struct UnusedImportCheckVisitor<'a, 'b: 'a> {
|
||||
resolver: &'a mut Resolver<'b>,
|
||||
/// All the (so far) unused imports, grouped path list
|
||||
unused_imports: NodeMap<NodeMap<Span>>,
|
||||
base_id: ast::NodeId,
|
||||
@ -40,21 +40,21 @@ struct UnusedImportCheckVisitor<'a, 'b: 'a, 'd: 'b> {
|
||||
}
|
||||
|
||||
// Deref and DerefMut impls allow treating UnusedImportCheckVisitor as Resolver.
|
||||
impl<'a, 'b, 'd> Deref for UnusedImportCheckVisitor<'a, 'b, 'd> {
|
||||
type Target = Resolver<'b, 'd>;
|
||||
impl<'a, 'b> Deref for UnusedImportCheckVisitor<'a, 'b> {
|
||||
type Target = Resolver<'b>;
|
||||
|
||||
fn deref<'c>(&'c self) -> &'c Resolver<'b, 'd> {
|
||||
fn deref<'c>(&'c self) -> &'c Resolver<'b> {
|
||||
&*self.resolver
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'd> DerefMut for UnusedImportCheckVisitor<'a, 'b, 'd> {
|
||||
fn deref_mut<'c>(&'c mut self) -> &'c mut Resolver<'b, 'd> {
|
||||
impl<'a, 'b> DerefMut for UnusedImportCheckVisitor<'a, 'b> {
|
||||
fn deref_mut<'c>(&'c mut self) -> &'c mut Resolver<'b> {
|
||||
&mut *self.resolver
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'd> UnusedImportCheckVisitor<'a, 'b, 'd> {
|
||||
impl<'a, 'b> UnusedImportCheckVisitor<'a, 'b> {
|
||||
// We have information about whether `use` (import) directives are actually
|
||||
// used now. If an import is not used at all, we signal a lint error.
|
||||
fn check_import(&mut self, item_id: ast::NodeId, id: ast::NodeId, span: Span) {
|
||||
@ -77,7 +77,7 @@ impl<'a, 'b, 'd> UnusedImportCheckVisitor<'a, 'b, 'd> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'cl> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b, 'cl> {
|
||||
impl<'a, 'b> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b> {
|
||||
fn visit_item(&mut self, item: &'a ast::Item) {
|
||||
self.item_span = item.span;
|
||||
|
||||
|
@ -17,7 +17,7 @@ use syntax_pos::Span;
|
||||
use resolve_imports::ImportResolver;
|
||||
use std::cmp::Reverse;
|
||||
|
||||
impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
|
||||
impl<'a, 'b:'a> ImportResolver<'a, 'b> {
|
||||
/// Add suggestions for a path that cannot be resolved.
|
||||
pub(crate) fn make_path_suggestion(
|
||||
&mut self,
|
||||
|
@ -742,7 +742,7 @@ impl<'tcx> Visitor<'tcx> for UsePlacementFinder {
|
||||
}
|
||||
|
||||
/// This thing walks the whole crate in DFS manner, visiting each item, resolving names as it goes.
|
||||
impl<'a, 'tcx, 'cl> Visitor<'tcx> for Resolver<'a, 'cl> {
|
||||
impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> {
|
||||
fn visit_item(&mut self, item: &'tcx Item) {
|
||||
self.resolve_item(item);
|
||||
}
|
||||
@ -1476,7 +1476,7 @@ pub struct ExternPreludeEntry<'a> {
|
||||
/// The main resolver class.
|
||||
///
|
||||
/// This is the visitor that walks the whole crate.
|
||||
pub struct Resolver<'a, 'b: 'a> {
|
||||
pub struct Resolver<'a> {
|
||||
session: &'a Session,
|
||||
cstore: &'a CStore,
|
||||
|
||||
@ -1580,7 +1580,7 @@ pub struct Resolver<'a, 'b: 'a> {
|
||||
arenas: &'a ResolverArenas<'a>,
|
||||
dummy_binding: &'a NameBinding<'a>,
|
||||
|
||||
crate_loader: &'a mut CrateLoader<'b>,
|
||||
crate_loader: &'a mut CrateLoader<'a>,
|
||||
macro_names: FxHashSet<Ident>,
|
||||
builtin_macros: FxHashMap<Name, &'a NameBinding<'a>>,
|
||||
macro_use_prelude: FxHashMap<Name, &'a NameBinding<'a>>,
|
||||
@ -1654,7 +1654,7 @@ impl<'a> ResolverArenas<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b: 'a, 'cl: 'b> ty::DefIdTree for &'a Resolver<'b, 'cl> {
|
||||
impl<'a, 'b: 'a> ty::DefIdTree for &'a Resolver<'b> {
|
||||
fn parent(self, id: DefId) -> Option<DefId> {
|
||||
match id.krate {
|
||||
LOCAL_CRATE => self.definitions.def_key(id.index).parent,
|
||||
@ -1665,7 +1665,7 @@ impl<'a, 'b: 'a, 'cl: 'b> ty::DefIdTree for &'a Resolver<'b, 'cl> {
|
||||
|
||||
/// This interface is used through the AST→HIR step, to embed full paths into the HIR. After that
|
||||
/// the resolver is no longer needed as all the relevant information is inline.
|
||||
impl<'a, 'cl> hir::lowering::Resolver for Resolver<'a, 'cl> {
|
||||
impl<'a> hir::lowering::Resolver for Resolver<'a> {
|
||||
fn resolve_hir_path(
|
||||
&mut self,
|
||||
path: &ast::Path,
|
||||
@ -1711,7 +1711,7 @@ impl<'a, 'cl> hir::lowering::Resolver for Resolver<'a, 'cl> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
|
||||
impl<'a> Resolver<'a> {
|
||||
/// Rustdoc uses this to resolve things in a recoverable way. ResolutionError<'a>
|
||||
/// isn't something that can be returned because it can't be made to live that long,
|
||||
/// and also it's a private type. Fortunately rustdoc doesn't need to know the error,
|
||||
@ -1800,15 +1800,15 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
|
||||
impl<'a> Resolver<'a> {
|
||||
pub fn new(session: &'a Session,
|
||||
cstore: &'a CStore,
|
||||
krate: &Crate,
|
||||
crate_name: &str,
|
||||
make_glob_map: MakeGlobMap,
|
||||
crate_loader: &'a mut CrateLoader<'crateloader>,
|
||||
crate_loader: &'a mut CrateLoader<'a>,
|
||||
arenas: &'a ResolverArenas<'a>)
|
||||
-> Resolver<'a, 'crateloader> {
|
||||
-> Resolver<'a> {
|
||||
let root_def_id = DefId::local(CRATE_DEF_INDEX);
|
||||
let root_module_kind = ModuleKind::Def(Def::Mod(root_def_id), keywords::Invalid.name());
|
||||
let graph_root = arenas.alloc_module(ModuleData {
|
||||
|
@ -121,7 +121,7 @@ fn sub_namespace_match(candidate: Option<MacroKind>, requirement: Option<MacroKi
|
||||
candidate.is_none() || requirement.is_none() || candidate == requirement
|
||||
}
|
||||
|
||||
impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
|
||||
impl<'a> base::Resolver for Resolver<'a> {
|
||||
fn next_node_id(&mut self) -> ast::NodeId {
|
||||
self.session.next_node_id()
|
||||
}
|
||||
@ -139,11 +139,11 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
|
||||
}
|
||||
|
||||
fn eliminate_crate_var(&mut self, item: P<ast::Item>) -> P<ast::Item> {
|
||||
struct EliminateCrateVar<'b, 'a: 'b, 'crateloader: 'a>(
|
||||
&'b mut Resolver<'a, 'crateloader>, Span
|
||||
struct EliminateCrateVar<'b, 'a: 'b>(
|
||||
&'b mut Resolver<'a>, Span
|
||||
);
|
||||
|
||||
impl<'a, 'b, 'crateloader> Folder for EliminateCrateVar<'a, 'b, 'crateloader> {
|
||||
impl<'a, 'b> Folder for EliminateCrateVar<'a, 'b> {
|
||||
fn fold_path(&mut self, path: ast::Path) -> ast::Path {
|
||||
match self.fold_qpath(None, path) {
|
||||
(None, path) => path,
|
||||
@ -290,7 +290,7 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'cl> Resolver<'a, 'cl> {
|
||||
impl<'a> Resolver<'a> {
|
||||
pub fn dummy_parent_scope(&self) -> ParentScope<'a> {
|
||||
self.invoc_parent_scope(Mark::root(), Vec::new())
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ impl<'a> NameResolution<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
|
||||
impl<'a> Resolver<'a> {
|
||||
fn resolution(&self, module: Module<'a>, ident: Ident, ns: Namespace)
|
||||
-> &'a RefCell<NameResolution<'a>> {
|
||||
*module.resolutions.borrow_mut().entry((ident.modern(), ns))
|
||||
@ -541,7 +541,7 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
|
||||
// If the resolution becomes a success, define it in the module's glob importers.
|
||||
fn update_resolution<T, F>(&mut self, module: Module<'a>, ident: Ident, ns: Namespace, f: F)
|
||||
-> T
|
||||
where F: FnOnce(&mut Resolver<'a, 'crateloader>, &mut NameResolution<'a>) -> T
|
||||
where F: FnOnce(&mut Resolver<'a>, &mut NameResolution<'a>) -> T
|
||||
{
|
||||
// Ensure that `resolution` isn't borrowed when defining in the module's glob importers,
|
||||
// during which the resolution might end up getting re-defined via a glob cycle.
|
||||
@ -592,30 +592,30 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ImportResolver<'a, 'b: 'a, 'c: 'a + 'b> {
|
||||
pub resolver: &'a mut Resolver<'b, 'c>,
|
||||
pub struct ImportResolver<'a, 'b: 'a> {
|
||||
pub resolver: &'a mut Resolver<'b>,
|
||||
}
|
||||
|
||||
impl<'a, 'b: 'a, 'c: 'a + 'b> ::std::ops::Deref for ImportResolver<'a, 'b, 'c> {
|
||||
type Target = Resolver<'b, 'c>;
|
||||
fn deref(&self) -> &Resolver<'b, 'c> {
|
||||
impl<'a, 'b: 'a> ::std::ops::Deref for ImportResolver<'a, 'b> {
|
||||
type Target = Resolver<'b>;
|
||||
fn deref(&self) -> &Resolver<'b> {
|
||||
self.resolver
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b: 'a, 'c: 'a + 'b> ::std::ops::DerefMut for ImportResolver<'a, 'b, 'c> {
|
||||
fn deref_mut(&mut self) -> &mut Resolver<'b, 'c> {
|
||||
impl<'a, 'b: 'a> ::std::ops::DerefMut for ImportResolver<'a, 'b> {
|
||||
fn deref_mut(&mut self) -> &mut Resolver<'b> {
|
||||
self.resolver
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b: 'a, 'c: 'a + 'b> ty::DefIdTree for &'a ImportResolver<'a, 'b, 'c> {
|
||||
impl<'a, 'b: 'a> ty::DefIdTree for &'a ImportResolver<'a, 'b> {
|
||||
fn parent(self, id: DefId) -> Option<DefId> {
|
||||
self.resolver.parent(id)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
|
||||
impl<'a, 'b:'a> ImportResolver<'a, 'b> {
|
||||
// Import resolution
|
||||
//
|
||||
// This is a fixed-point algorithm. We resolve imports until our efforts
|
||||
|
@ -17,13 +17,13 @@ use self::def_ctor::{get_def_from_def_id, get_def_from_node_id};
|
||||
|
||||
use super::*;
|
||||
|
||||
pub struct AutoTraitFinder<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
|
||||
pub cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>,
|
||||
pub struct AutoTraitFinder<'a, 'tcx: 'a, 'rcx: 'a> {
|
||||
pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>,
|
||||
pub f: auto::AutoTraitFinder<'a, 'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'rcx, 'cstore> AutoTraitFinder<'a, 'tcx, 'rcx, 'cstore> {
|
||||
pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>) -> Self {
|
||||
impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
|
||||
pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> Self {
|
||||
let f = auto::AutoTraitFinder::new(&cx.tcx);
|
||||
|
||||
AutoTraitFinder { cx, f }
|
||||
|
@ -21,12 +21,12 @@ use super::*;
|
||||
|
||||
use self::def_ctor::{get_def_from_def_id, get_def_from_node_id};
|
||||
|
||||
pub struct BlanketImplFinder<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
|
||||
pub cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>,
|
||||
pub struct BlanketImplFinder<'a, 'tcx: 'a, 'rcx: 'a> {
|
||||
pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'rcx, 'cstore> BlanketImplFinder <'a, 'tcx, 'rcx, 'cstore> {
|
||||
pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>) -> Self {
|
||||
impl<'a, 'tcx, 'rcx> BlanketImplFinder <'a, 'tcx, 'rcx> {
|
||||
pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> Self {
|
||||
BlanketImplFinder { cx }
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ pub struct Crate {
|
||||
pub masked_crates: FxHashSet<CrateNum>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'rcx, 'cstore> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
|
||||
impl<'a, 'tcx, 'rcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx, 'rcx> {
|
||||
fn clean(&self, cx: &DocContext) -> Crate {
|
||||
use ::visit_lib::LibEmbargoVisitor;
|
||||
|
||||
|
@ -55,9 +55,9 @@ pub use rustc::session::search_paths::SearchPath;
|
||||
|
||||
pub type ExternalPaths = FxHashMap<DefId, (Vec<String>, clean::TypeKind)>;
|
||||
|
||||
pub struct DocContext<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
|
||||
pub struct DocContext<'a, 'tcx: 'a, 'rcx: 'a> {
|
||||
pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
pub resolver: &'a RefCell<resolve::Resolver<'rcx, 'cstore>>,
|
||||
pub resolver: &'a RefCell<resolve::Resolver<'rcx>>,
|
||||
/// The stack of module NodeIds up till this point
|
||||
pub crate_name: Option<String>,
|
||||
pub cstore: Rc<CStore>,
|
||||
@ -88,7 +88,7 @@ pub struct DocContext<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
|
||||
pub all_traits: Vec<DefId>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'rcx, 'cstore> DocContext<'a, 'tcx, 'rcx, 'cstore> {
|
||||
impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> {
|
||||
pub fn sess(&self) -> &session::Session {
|
||||
&self.tcx.sess
|
||||
}
|
||||
|
@ -53,14 +53,14 @@ enum PathKind {
|
||||
Type,
|
||||
}
|
||||
|
||||
struct LinkCollector<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
|
||||
cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>,
|
||||
struct LinkCollector<'a, 'tcx: 'a, 'rcx: 'a> {
|
||||
cx: &'a DocContext<'a, 'tcx, 'rcx>,
|
||||
mod_ids: Vec<NodeId>,
|
||||
is_nightly_build: bool,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'rcx, 'cstore> LinkCollector<'a, 'tcx, 'rcx, 'cstore> {
|
||||
fn new(cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>) -> Self {
|
||||
impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> {
|
||||
fn new(cx: &'a DocContext<'a, 'tcx, 'rcx>) -> Self {
|
||||
LinkCollector {
|
||||
cx,
|
||||
mod_ids: Vec::new(),
|
||||
@ -213,7 +213,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> LinkCollector<'a, 'tcx, 'rcx, 'cstore> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'rcx, 'cstore> DocFolder for LinkCollector<'a, 'tcx, 'rcx, 'cstore> {
|
||||
impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> {
|
||||
fn fold_item(&mut self, mut item: Item) -> Option<Item> {
|
||||
let item_node_id = if item.is_mod() {
|
||||
if let Some(id) = self.cx.tcx.hir().as_local_node_id(item.def_id) {
|
||||
|
@ -147,13 +147,13 @@ pub fn collect_trait_impls(krate: Crate, cx: &DocContext) -> Crate {
|
||||
krate
|
||||
}
|
||||
|
||||
struct SyntheticImplCollector<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
|
||||
cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>,
|
||||
struct SyntheticImplCollector<'a, 'tcx: 'a, 'rcx: 'a> {
|
||||
cx: &'a DocContext<'a, 'tcx, 'rcx>,
|
||||
impls: Vec<Item>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'rcx, 'cstore> SyntheticImplCollector<'a, 'tcx, 'rcx, 'cstore> {
|
||||
fn new(cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>) -> Self {
|
||||
impl<'a, 'tcx, 'rcx> SyntheticImplCollector<'a, 'tcx, 'rcx> {
|
||||
fn new(cx: &'a DocContext<'a, 'tcx, 'rcx>) -> Self {
|
||||
SyntheticImplCollector {
|
||||
cx,
|
||||
impls: Vec::new(),
|
||||
@ -161,7 +161,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> SyntheticImplCollector<'a, 'tcx, 'rcx, 'cstore> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'rcx, 'cstore> DocFolder for SyntheticImplCollector<'a, 'tcx, 'rcx, 'cstore> {
|
||||
impl<'a, 'tcx, 'rcx> DocFolder for SyntheticImplCollector<'a, 'tcx, 'rcx> {
|
||||
fn fold_item(&mut self, i: Item) -> Option<Item> {
|
||||
if i.is_struct() || i.is_enum() || i.is_union() {
|
||||
if let (Some(node_id), Some(name)) =
|
||||
|
@ -361,8 +361,8 @@ impl fold::DocFolder for ImportStripper {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn look_for_tests<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx>(
|
||||
cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>,
|
||||
pub fn look_for_tests<'a, 'tcx: 'a, 'rcx: 'a>(
|
||||
cx: &'a DocContext<'a, 'tcx, 'rcx>,
|
||||
dox: &str,
|
||||
item: &Item,
|
||||
check_missing_code: bool,
|
||||
|
@ -19,12 +19,12 @@ pub const CHECK_PRIVATE_ITEMS_DOC_TESTS: Pass =
|
||||
Pass::early("check-private-items-doc-tests", check_private_items_doc_tests,
|
||||
"check private items doc tests");
|
||||
|
||||
struct PrivateItemDocTestLinter<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
|
||||
cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>,
|
||||
struct PrivateItemDocTestLinter<'a, 'tcx: 'a, 'rcx: 'a> {
|
||||
cx: &'a DocContext<'a, 'tcx, 'rcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'rcx, 'cstore> PrivateItemDocTestLinter<'a, 'tcx, 'rcx, 'cstore> {
|
||||
fn new(cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>) -> Self {
|
||||
impl<'a, 'tcx, 'rcx> PrivateItemDocTestLinter<'a, 'tcx, 'rcx> {
|
||||
fn new(cx: &'a DocContext<'a, 'tcx, 'rcx>) -> Self {
|
||||
PrivateItemDocTestLinter {
|
||||
cx,
|
||||
}
|
||||
@ -37,7 +37,7 @@ pub fn check_private_items_doc_tests(krate: Crate, cx: &DocContext) -> Crate {
|
||||
coll.fold_crate(krate)
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'rcx, 'cstore> DocFolder for PrivateItemDocTestLinter<'a, 'tcx, 'rcx, 'cstore> {
|
||||
impl<'a, 'tcx, 'rcx> DocFolder for PrivateItemDocTestLinter<'a, 'tcx, 'rcx> {
|
||||
fn fold_item(&mut self, item: Item) -> Option<Item> {
|
||||
let cx = self.cx;
|
||||
let dox = item.attrs.collapsed_doc_value().unwrap_or_else(String::new);
|
||||
|
@ -36,10 +36,10 @@ use doctree::*;
|
||||
// Also, is there some reason that this doesn't use the 'visit'
|
||||
// framework from syntax?.
|
||||
|
||||
pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
|
||||
pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a> {
|
||||
pub module: Module,
|
||||
pub attrs: hir::HirVec<ast::Attribute>,
|
||||
pub cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>,
|
||||
pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>,
|
||||
view_item_stack: FxHashSet<ast::NodeId>,
|
||||
inlining: bool,
|
||||
/// Are the current module and all of its parents public?
|
||||
@ -47,10 +47,10 @@ pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
|
||||
exact_paths: Option<FxHashMap<DefId, Vec<String>>>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'rcx, 'cstore> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
|
||||
impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> {
|
||||
pub fn new(
|
||||
cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>
|
||||
) -> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
|
||||
cx: &'a core::DocContext<'a, 'tcx, 'rcx>
|
||||
) -> RustdocVisitor<'a, 'tcx, 'rcx> {
|
||||
// If the root is re-exported, terminate all recursion.
|
||||
let mut stack = FxHashSet::default();
|
||||
stack.insert(ast::CRATE_NODE_ID);
|
||||
|
@ -22,8 +22,8 @@ use clean::{AttributesExt, NestedAttributesExt};
|
||||
|
||||
/// Similar to `librustc_privacy::EmbargoVisitor`, but also takes
|
||||
/// specific rustdoc annotations into account (i.e., `doc(hidden)`)
|
||||
pub struct LibEmbargoVisitor<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
|
||||
cx: &'a ::core::DocContext<'a, 'tcx, 'rcx, 'cstore>,
|
||||
pub struct LibEmbargoVisitor<'a, 'tcx: 'a, 'rcx: 'a> {
|
||||
cx: &'a ::core::DocContext<'a, 'tcx, 'rcx>,
|
||||
// Accessibility levels for reachable nodes
|
||||
access_levels: RefMut<'a, AccessLevels<DefId>>,
|
||||
// Previous accessibility level, None means unreachable
|
||||
@ -32,10 +32,10 @@ pub struct LibEmbargoVisitor<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
|
||||
visited_mods: FxHashSet<DefId>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'rcx, 'cstore> LibEmbargoVisitor<'a, 'tcx, 'rcx, 'cstore> {
|
||||
impl<'a, 'tcx, 'rcx> LibEmbargoVisitor<'a, 'tcx, 'rcx> {
|
||||
pub fn new(
|
||||
cx: &'a ::core::DocContext<'a, 'tcx, 'rcx, 'cstore>
|
||||
) -> LibEmbargoVisitor<'a, 'tcx, 'rcx, 'cstore> {
|
||||
cx: &'a ::core::DocContext<'a, 'tcx, 'rcx>
|
||||
) -> LibEmbargoVisitor<'a, 'tcx, 'rcx> {
|
||||
LibEmbargoVisitor {
|
||||
cx,
|
||||
access_levels: RefMut::map(cx.renderinfo.borrow_mut(), |ri| &mut ri.access_levels),
|
||||
|
Loading…
Reference in New Issue
Block a user