Represent ownership transfer in RustdocVisitor::visit

Previously visit could be called multiple times, but this is inaccurate,
as it deconstructs Visitor state.
This commit is contained in:
Mark Rousskov
2019-07-24 15:24:25 -04:00
parent 2d18504c27
commit 2fadc4524d
3 changed files with 7 additions and 5 deletions

View File

@@ -49,7 +49,6 @@ use parking_lot::ReentrantMutex;
use crate::core::{self, DocContext};
use crate::doctree;
use crate::visit_ast;
use crate::html::render::{cache, ExternalLocation};
use crate::html::item_type::ItemType;
@@ -138,7 +137,10 @@ pub struct Crate {
pub masked_crates: FxHashSet<CrateNum>,
}
impl<'a, 'tcx> Clean<Crate> for (visit_ast::RustdocVisitor<'a, 'tcx>, doctree::Module<'tcx>) {
// The `()` here is rather ugly and would be great to remove. Unfortunately, we
// already have a different Clean impl for `doctree::Module` which makes this
// the only way to easily disambiguate.
impl<'tcx> Clean<Crate> for ((), doctree::Module<'tcx>) {
fn clean(&self, cx: &DocContext<'_>) -> Crate {
use crate::visit_lib::LibEmbargoVisitor;