rustc: Rename item_body query to extern_const_body
Should hopefully more accurately reflect what's happening! This commit also removes the cache in the cstore implementation as it's already cached through the query infrastructure.
This commit is contained in:
parent
7d9c98e475
commit
0182c8bbda
7 changed files with 12 additions and 15 deletions
|
@ -563,7 +563,7 @@ define_dep_nodes!( <'tcx>
|
|||
[] GetLangItems,
|
||||
[] DefinedLangItems(CrateNum),
|
||||
[] MissingLangItems(CrateNum),
|
||||
[] ItemBody(DefId),
|
||||
[] ExternConstBody(DefId),
|
||||
[] VisibleParentMap,
|
||||
[] IsDirectExternCrate(CrateNum),
|
||||
[] MissingExternCrateItem(CrateNum),
|
||||
|
|
|
@ -1357,7 +1357,7 @@ define_maps! { <'tcx>
|
|||
[] get_lang_items: get_lang_items_node(CrateNum) -> Rc<LanguageItems>,
|
||||
[] defined_lang_items: DefinedLangItems(CrateNum) -> Rc<Vec<(DefIndex, usize)>>,
|
||||
[] missing_lang_items: MissingLangItems(CrateNum) -> Rc<Vec<LangItem>>,
|
||||
[] item_body: ItemBody(DefId) -> &'tcx hir::Body,
|
||||
[] extern_const_body: ExternConstBody(DefId) -> &'tcx hir::Body,
|
||||
[] visible_parent_map: visible_parent_map_node(CrateNum)
|
||||
-> Rc<DefIdMap<DefId>>,
|
||||
[] missing_extern_crate_item: MissingExternCrateItem(CrateNum) -> bool,
|
||||
|
|
|
@ -354,7 +354,7 @@ fn eval_const_expr_partial<'a, 'tcx>(cx: &ConstContext<'a, 'tcx>,
|
|||
}
|
||||
} else {
|
||||
if tcx.is_const_fn(def_id) {
|
||||
tcx.item_body(def_id)
|
||||
tcx.extern_const_body(def_id)
|
||||
} else {
|
||||
signal!(e, TypeckError)
|
||||
}
|
||||
|
@ -774,7 +774,7 @@ fn const_eval<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
tcx.mir_const_qualif(def_id);
|
||||
tcx.hir.body(tcx.hir.body_owned_by(id))
|
||||
} else {
|
||||
tcx.item_body(def_id)
|
||||
tcx.extern_const_body(def_id)
|
||||
};
|
||||
ConstContext::new(tcx, key.param_env.and(substs), tables).eval(&body.value)
|
||||
}
|
||||
|
|
|
@ -609,7 +609,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
|
|||
let body = if let Some(id) = self.tcx.hir.as_local_node_id(def_id) {
|
||||
self.tcx.hir.body(self.tcx.hir.body_owned_by(id))
|
||||
} else {
|
||||
self.tcx.item_body(def_id)
|
||||
self.tcx.extern_const_body(def_id)
|
||||
};
|
||||
let pat = self.lower_const_expr(&body.value, pat_id, span);
|
||||
self.tables = old_tables;
|
||||
|
|
|
@ -215,12 +215,9 @@ provide! { <'tcx> tcx, def_id, other, cdata,
|
|||
defined_lang_items => { Rc::new(cdata.get_lang_items(&tcx.dep_graph)) }
|
||||
missing_lang_items => { Rc::new(cdata.get_missing_lang_items(&tcx.dep_graph)) }
|
||||
|
||||
item_body => {
|
||||
if let Some(cached) = tcx.hir.get_inlined_body_untracked(def_id) {
|
||||
return cached;
|
||||
}
|
||||
extern_const_body => {
|
||||
debug!("item_body({:?}): inlining item", def_id);
|
||||
cdata.item_body(tcx, def_id.index)
|
||||
cdata.extern_const_body(tcx, def_id.index)
|
||||
}
|
||||
|
||||
missing_extern_crate_item => {
|
||||
|
|
|
@ -759,10 +759,10 @@ impl<'a, 'tcx> CrateMetadata {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn item_body(&self,
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
id: DefIndex)
|
||||
-> &'tcx hir::Body {
|
||||
pub fn extern_const_body(&self,
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
id: DefIndex)
|
||||
-> &'tcx hir::Body {
|
||||
assert!(!self.is_proc_macro(id));
|
||||
let ast = self.entry(id).ast.unwrap();
|
||||
let def_id = self.local_def_id(id);
|
||||
|
|
|
@ -474,7 +474,7 @@ impl hir::print::PpAnn for InlinedConst {
|
|||
}
|
||||
|
||||
fn print_inlined_const(cx: &DocContext, did: DefId) -> String {
|
||||
let body = cx.tcx.item_body(did);
|
||||
let body = cx.tcx.extern_const_body(did);
|
||||
let inlined = InlinedConst {
|
||||
nested_bodies: cx.tcx.item_body_nested_bodies(did)
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue