]> git.lizzy.rs Git - rust.git/commitdiff
rustc: Rename item_body query to extern_const_body
authorAlex Crichton <alex@alexcrichton.com>
Thu, 31 Aug 2017 22:10:58 +0000 (15:10 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 5 Sep 2017 14:37:58 +0000 (07:37 -0700)
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.

src/librustc/dep_graph/dep_node.rs
src/librustc/ty/maps.rs
src/librustc_const_eval/eval.rs
src/librustc_const_eval/pattern.rs
src/librustc_metadata/cstore_impl.rs
src/librustc_metadata/decoder.rs
src/librustdoc/clean/inline.rs

index d1453c247a3532aeba5fb2325e046b454a58f961..431680eb36a01e279454ace3ed973c374347d84d 100644 (file)
@@ -563,7 +563,7 @@ pub fn to_dep_node(self, tcx: TyCtxt, kind: DepKind) -> DepNode {
     [] GetLangItems,
     [] DefinedLangItems(CrateNum),
     [] MissingLangItems(CrateNum),
-    [] ItemBody(DefId),
+    [] ExternConstBody(DefId),
     [] VisibleParentMap,
     [] IsDirectExternCrate(CrateNum),
     [] MissingExternCrateItem(CrateNum),
index 9f8eb2f75350ed58185d6a9eed54b0e04ffeeb61..ef21a3d56fe03b83dd7c24b25870ad2f4095bad3 100644 (file)
@@ -1357,7 +1357,7 @@ fn default() -> Self {
     [] 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,
index d93718071979535d32b54d4a11f23cb4e06ad76f..27a25ff73d15ee1b6ba5da74fa174cffadc4ec78 100644 (file)
@@ -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)
 }
index a4040834cf5830e3b94f3fb44c878d5fe7315108..5e1fbbc9ca2cf2b2faf37bcb6a1d49cbaacf1022 100644 (file)
@@ -609,7 +609,7 @@ fn lower_path(&mut self,
                         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;
index 445ac601cb9737dc744c0fb644096a90167fbd88..58ca22f7bf38aa75d959e675e8e3bc39fc10322e 100644 (file)
@@ -215,12 +215,9 @@ fn into_args(self) -> (DefId, DefId) { (self.0.as_def_id(), self.1) }
     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 => {
index 1e2f167f199621e466c99b5959d992beb354d0c6..2523c97cfab84ee7d0b40e15ecac8565d45e3053 100644 (file)
@@ -759,10 +759,10 @@ pub fn each_child_of_item<F>(&self, id: DefIndex, mut callback: F, sess: &Sessio
         }
     }
 
-    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);
index d3b4d30208be13fb5a69da4778124f1372a9c988..11fe8a64d4102681892b2060ff9554f36cf3ab92 100644 (file)
@@ -474,7 +474,7 @@ fn nested(&self, state: &mut hir::print::State, nested: hir::print::Nested)
 }
 
 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)
     };