/// This should only return `None` during testing.
fn definitions(&mut self) -> &mut Definitions;
- /// Given suffix ["b","c","d"], returns path `::cratename::b::c::d` when
- /// The path is also resolved according to `is_value`.
- fn std_path(&mut self, span: Span, crate_root: Option<&str>,
+ /// Given suffix ["b","c","d"], creates a HIR path for `[::crate_root]::b::c::d` and resolves
+ /// it based on `is_value`.
+ fn resolve_str_path(&mut self, span: Span, crate_root: Option<&str>,
components: &[&str], is_value: bool) -> hir::Path {
let mut path = hir::Path {
span,
/// `fld.cx.use_std`, and `::core::b::c::d` otherwise.
/// The path is also resolved according to `is_value`.
fn std_path(&mut self, span: Span, components: &[&str], is_value: bool) -> hir::Path {
- self.resolver.std_path(span, self.crate_root, components, is_value)
+ self.resolver.resolve_str_path(span, self.crate_root, components, is_value)
}
fn signal_block_expr(&mut self,
/// standard library and prelude, and name resolution.
///
/// Returns `None` if we're aborting after handling -W help.
-pub fn phase_2_configure_and_expand<'a, F>(sess: &'a Session,
- cstore: &'a CStore,
+pub fn phase_2_configure_and_expand<F>(sess: &Session,
+ cstore: &CStore,
krate: ast::Crate,
registry: Option<Registry>,
crate_name: &str,
// this back at some point.
let mut crate_loader = CrateLoader::new(sess, &cstore, &crate_name);
let resolver_arenas = Resolver::arenas();
- let result = phase_2_configure_and_expand_inner(sess, cstore, krate, registry, crate_name, addl_plugins,
- make_glob_map, &resolver_arenas, &mut crate_loader, after_expand);
+ let result = phase_2_configure_and_expand_inner(sess, cstore, krate, registry, crate_name,
+ addl_plugins, make_glob_map, &resolver_arenas,
+ &mut crate_loader, after_expand);
match result {
Ok(InnerExpansionResult {expanded_crate, resolver, hir_forest}) => {
Ok(ExpansionResult {
pub masked_crates: FxHashSet<CrateNum>,
}
-impl<'a, 'b, 'tcx, 'rcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'b, 'tcx, 'rcx> {
+impl<'a, 'tcx, 'rcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx, 'rcx> {
fn clean(&self, cx: &DocContext) -> Crate {
use ::visit_lib::LibEmbargoVisitor;
}
let path = {
- // This allocation could be avoided if std_path could take an iterator;
+ // This allocation could be avoided if resolve_str_path could take an iterator;
// but it can't because that would break object safety. This can still be
// fixed.
let components = link.split("::").skip(1).collect::<Vec<_>>();
- cx.resolver.borrow_mut().std_path(DUMMY_SP, None, &components, false)
+ cx.resolver.borrow_mut().resolve_str_path(DUMMY_SP, None, &components, false)
};
if path.def != Def::Err {
fn next(&mut self) -> Option<Self::Item> {
let event = self.inner.next();
if let Some(Event::Start(Tag::Link(dest, text))) = event {
- if let Some(&(_, ref replace)) = self.links.into_iter().find(|link| &*link.0 == &*dest) {
+ if let Some(&(_, ref replace)) = self.links.into_iter().find(|link| &*link.0 == &*dest)
+ {
Some(Event::Start(Tag::Link(replace.to_owned().into(), text)))
} else {
Some(Event::Start(Tag::Link(dest, text)))
let mut s = String::with_capacity(md.len() * 3 / 2);
html::push_html(&mut s,
- Footnotes::new(CodeBlocks::new(LinkReplacer::new(HeadingLinks::new(p, None), links))));
+ Footnotes::new(
+ CodeBlocks::new(
+ LinkReplacer::new(
+ HeadingLinks::new(p, None),
+ links))));
fmt.write_str(&s)
}
hoedown_document_free(document);
hoedown_html_renderer_free(renderer);
+ hoedown_buffer_free(ob);
opaque.links.unwrap()
}
prefix: &str,
scx: &SharedContext)
-> fmt::Result {
- let (hoedown_output, pulldown_output) = render_text(|ty| format!("{}", Markdown(md_text, &links, ty)));
+ let (hoedown_output, pulldown_output) =
+ render_text(|ty| format!("{}", Markdown(md_text, &links, ty)));
let mut differences = html_diff::get_differences(&pulldown_output, &hoedown_output);
differences.retain(|s| {
match *s {
} else {
format!("{}", &plain_summary_line(Some(s)))
};
- render_markdown(w, &markdown, item.links(), item.source.clone(), cx.render_type, prefix, &cx.shared)?;
+ render_markdown(w,
+ &markdown,
+ item.links(),
+ item.source.clone(),
+ cx.render_type,
+ prefix,
+ &cx.shared)?;
} else if !prefix.is_empty() {
write!(w, "<div class='docblock'>{}</div>", prefix)?;
}
cx: &Context, prefix: &str) -> fmt::Result {
if let Some(s) = cx.shared.maybe_collapsed_doc_value(item) {
debug!("Doc block: =====\n{}\n=====", s);
- render_markdown(w, &*s, item.links(), item.source.clone(), cx.render_type, prefix, &cx.shared)?;
+ render_markdown(w,
+ &*s,
+ item.links(),
+ item.source.clone(),
+ cx.render_type,
+ prefix,
+ &cx.shared)?;
} else if !prefix.is_empty() {
write!(w, "<div class='docblock'>{}</div>", prefix)?;
}
write!(w, "</span>")?;
write!(w, "</h3>\n")?;
if let Some(ref dox) = cx.shared.maybe_collapsed_doc_value(&i.impl_item) {
- write!(w, "<div class='docblock'>{}</div>", Markdown(&*dox, &i.impl_item.links(), cx.render_type))?;
+ write!(w, "<div class='docblock'>{}</div>",
+ Markdown(&*dox, &i.impl_item.links(), cx.render_type))?;
}
}
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/")]
-
+#![deny(warnings)]
#![feature(ascii_ctype)]
#![feature(rustc_private)]
// also, is there some reason that this doesn't use the 'visit'
// framework from syntax?
-pub struct RustdocVisitor<'a, 'b: 'a, 'tcx: 'b, 'rcx: 'b> {
+pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a> {
cstore: &'a CrateStore,
pub module: Module,
pub attrs: hir::HirVec<ast::Attribute>,
- pub cx: &'a core::DocContext<'b, 'tcx, 'rcx>,
+ pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>,
view_item_stack: FxHashSet<ast::NodeId>,
inlining: bool,
/// Is the current module and all of its parents public?
reexported_macros: FxHashSet<DefId>,
}
-impl<'a, 'b, 'tcx, 'rcx> RustdocVisitor<'a, 'b, 'tcx, 'rcx> {
+impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> {
pub fn new(cstore: &'a CrateStore,
- cx: &'a core::DocContext<'b, 'tcx, 'rcx>) -> RustdocVisitor<'a, 'b, 'tcx, 'rcx> {
+ cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> RustdocVisitor<'a, 'tcx, 'rcx> {
// If the root is re-exported, terminate all recursion.
let mut stack = FxHashSet();
stack.insert(ast::CRATE_NODE_ID);
/// Similar to `librustc_privacy::EmbargoVisitor`, but also takes
/// specific rustdoc annotations into account (i.e. `doc(hidden)`)
-pub struct LibEmbargoVisitor<'a, 'b: 'a, 'tcx: 'b, 'rcx: 'b> {
- cx: &'a ::core::DocContext<'b, 'tcx, 'rcx>,
+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
visited_mods: FxHashSet<DefId>,
}
-impl<'a, 'b, 'tcx, 'rcx> LibEmbargoVisitor<'a, 'b, 'tcx, 'rcx> {
- pub fn new(cx: &'a ::core::DocContext<'b, 'tcx, 'rcx>) -> LibEmbargoVisitor<'a, 'b, 'tcx, 'rcx> {
+impl<'a, 'tcx, 'rcx> LibEmbargoVisitor<'a, 'tcx, 'rcx> {
+ pub fn new(cx: &'a ::core::DocContext<'a, 'tcx, 'rcx>) -> LibEmbargoVisitor<'a, 'tcx, 'rcx> {
LibEmbargoVisitor {
cx,
access_levels: cx.access_levels.borrow_mut(),