]> git.lizzy.rs Git - rust.git/commitdiff
impl_parent
authorachernyak <artemchernyak@gmail.com>
Thu, 4 May 2017 14:37:34 +0000 (09:37 -0500)
committerachernyak <artemchernyak@gmail.com>
Thu, 4 May 2017 14:37:34 +0000 (09:37 -0500)
src/librustc/dep_graph/dep_node.rs
src/librustc/middle/cstore.rs
src/librustc/ty/maps.rs
src/librustc/ty/mod.rs
src/librustc_metadata/cstore_impl.rs

index 0e462b95d820e392b1b779b466e2dcf47893b843..de1531bbd54d383d6de83084d979578ebbdbb0d4 100644 (file)
@@ -156,6 +156,7 @@ pub enum DepNode<D: Clone + Debug> {
     Deprecation(D),
     ItemBodyNestedBodies(D),
     ConstIsRvaluePromotableToStatic(D),
+    ImplParent(D),
     TraitOfItem(D),
     IsMirAvailable(D),
     ItemAttrs(D),
@@ -272,6 +273,7 @@ pub fn map_def<E, OP>(&self, mut op: OP) -> Option<DepNode<E>>
             Deprecation(ref d) => op(d).map(Deprecation),
             ItemAttrs(ref d) => op(d).map(ItemAttrs),
             FnArgNames(ref d) => op(d).map(FnArgNames),
+            ImplParent(ref d) => op(d).map(ImplParent),
             TraitOfItem(ref d) => op(d).map(TraitOfItem),
             ItemBodyNestedBodies(ref d) => op(d).map(ItemBodyNestedBodies),
             ConstIsRvaluePromotableToStatic(ref d) => op(d).map(ConstIsRvaluePromotableToStatic),
index 11a2dfc6685a192068cb29e146ae206fcac3cefe..e50072043d5f7c927ba74d3af306bdc16bb3dba9 100644 (file)
@@ -188,7 +188,6 @@ pub trait CrateStore {
 
     // impl info
     fn impl_defaultness(&self, def: DefId) -> hir::Defaultness;
-    fn impl_parent(&self, impl_def_id: DefId) -> Option<DefId>;
 
     // trait/impl-item info
     fn associated_item_cloned(&self, def: DefId) -> ty::AssociatedItem;
@@ -312,7 +311,6 @@ fn implementations_of_trait(&self, filter: Option<DefId>) -> Vec<DefId> { vec![]
 
     // impl info
     fn impl_defaultness(&self, def: DefId) -> hir::Defaultness { bug!("impl_defaultness") }
-    fn impl_parent(&self, def: DefId) -> Option<DefId> { bug!("impl_parent") }
 
     // trait/impl-item info
     fn associated_item_cloned(&self, def: DefId) -> ty::AssociatedItem
index 5d1b16c3d2e1c3c4207d0077b7c7cd5c5ced5279..1dfd7bc9760828720a97ad82e54163f8c2b48098 100644 (file)
@@ -347,6 +347,12 @@ fn describe(_: TyCtxt, _: DefId) -> String {
     }
 }
 
+impl<'tcx> QueryDescription for queries::impl_parent<'tcx> {
+    fn describe(_: TyCtxt, _: DefId) -> String {
+        bug!("impl_parent")
+    }
+}
+
 impl<'tcx> QueryDescription for queries::trait_of_item<'tcx> {
     fn describe(_: TyCtxt, _: DefId) -> String {
         bug!("trait_of_item")
@@ -804,6 +810,7 @@ fn default() -> Self {
     [] deprecation: Deprecation(DefId) -> Option<attr::Deprecation>,
     [] item_attrs: ItemAttrs(DefId) -> Rc<[ast::Attribute]>,
     [] fn_arg_names: FnArgNames(DefId) -> Vec<ast::Name>,
+    [] impl_parent: ImplParent(DefId) -> Option<DefId>,
     [] trait_of_item: TraitOfItem(DefId) -> Option<DefId>,
     [] item_body_nested_bodies: ItemBodyNestedBodies(DefId) -> Rc<BTreeMap<hir::BodyId, hir::Body>>,
     [] const_is_rvalue_promotable_to_static: ConstIsRvaluePromotableToStatic(DefId) -> bool,
index 00f81c9dcf7bc8c4296c9e330b5104025e0f85b0..1c3e74d4fb965e564d5d7df3f80beaefbc2ab1b5 100644 (file)
@@ -2393,7 +2393,7 @@ pub fn populate_implementations_for_trait_if_necessary(self, trait_id: DefId) {
             let trait_ref = self.impl_trait_ref(impl_def_id).unwrap();
 
             // Record the trait->implementation mapping.
-            let parent = self.sess.cstore.impl_parent(impl_def_id).unwrap_or(trait_id);
+            let parent = self.impl_parent(impl_def_id).unwrap_or(trait_id);
             def.record_remote_impl(self, impl_def_id, trait_ref, parent);
         }
 
index b07dd1ec7b0b84e69451f41ceb480680b009df2e..b54db55c0e12abe8d5728ef245071223edb79fd7 100644 (file)
@@ -119,6 +119,7 @@ pub fn provide<$lt>(providers: &mut Providers<$lt>) {
     // This is only used by rustdoc anyway, which shouldn't have
     // incremental recompilation ever enabled.
     fn_arg_names => { cdata.get_fn_arg_names(def_id.index) }
+    impl_parent => { cdata.get_parent_impl(def_id.index) }
     trait_of_item => { cdata.get_trait_of_item(def_id.index) }
     item_body_nested_bodies => {
         let map: BTreeMap<_, _> = cdata.entry(def_id.index).ast.into_iter().flat_map(|ast| {
@@ -170,11 +171,6 @@ fn impl_defaultness(&self, def: DefId) -> hir::Defaultness
         self.get_crate_data(def.krate).get_impl_defaultness(def.index)
     }
 
-    fn impl_parent(&self, impl_def: DefId) -> Option<DefId> {
-        self.dep_graph.read(DepNode::MetaData(impl_def));
-        self.get_crate_data(impl_def.krate).get_parent_impl(impl_def.index)
-    }
-
     fn associated_item_cloned(&self, def: DefId) -> ty::AssociatedItem
     {
         self.dep_graph.read(DepNode::MetaData(def));