rustdoc: pretty-print nested bodies in inlined constants.

This commit is contained in:
Eduard-Mihai Burtescu 2016-12-27 11:15:26 +02:00
parent 4aae835803
commit ee0ea95343
6 changed files with 79 additions and 5 deletions

View file

@ -856,7 +856,7 @@ pub enum UnsafeSource {
UserProvided,
}
#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash, Debug)]
pub struct BodyId {
pub node_id: NodeId,
}

View file

@ -33,6 +33,8 @@ use mir::Mir;
use session::Session;
use session::search_paths::PathKind;
use util::nodemap::{NodeSet, DefIdMap};
use std::collections::BTreeMap;
use std::path::PathBuf;
use std::rc::Rc;
use syntax::ast;
@ -250,6 +252,7 @@ pub trait CrateStore<'tcx> {
// misc. metadata
fn maybe_get_item_body<'a>(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
-> Option<&'tcx hir::Body>;
fn item_body_nested_bodies(&self, def: DefId) -> BTreeMap<hir::BodyId, hir::Body>;
fn const_is_rvalue_promotable_to_static(&self, def: DefId) -> bool;
fn get_item_mir<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId) -> Mir<'tcx>;
@ -421,6 +424,9 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
-> Option<&'tcx hir::Body> {
bug!("maybe_get_item_body")
}
fn item_body_nested_bodies(&self, def: DefId) -> BTreeMap<hir::BodyId, hir::Body> {
bug!("item_body_nested_bodies")
}
fn const_is_rvalue_promotable_to_static(&self, def: DefId) -> bool {
bug!("const_is_rvalue_promotable_to_static")
}