]> git.lizzy.rs Git - rust.git/commitdiff
fn_arg_names
authorachernyak <artemchernyak@gmail.com>
Wed, 3 May 2017 14:01:49 +0000 (09:01 -0500)
committerachernyak <artemchernyak@gmail.com>
Wed, 3 May 2017 14:01:49 +0000 (09:01 -0500)
src/librustc/dep_graph/dep_node.rs
src/librustc/middle/cstore.rs
src/librustc/ty/maps.rs
src/librustc_metadata/cstore_impl.rs
src/librustdoc/clean/mod.rs

index fb8678ce93eae793c9dca06d04ee682542bb7654..591c128a16559566860f10329d152f2c2d20effb 100644 (file)
@@ -158,6 +158,7 @@ pub enum DepNode<D: Clone + Debug> {
     ConstIsRvaluePromotableToStatic(D),
     IsMirAvailable(D),
     ItemAttrs(D),
+    FnArgNames(D),
 }
 
 impl<D: Clone + Debug> DepNode<D> {
@@ -269,6 +270,7 @@ pub fn map_def<E, OP>(&self, mut op: OP) -> Option<DepNode<E>>
             Stability(ref d) => op(d).map(Stability),
             Deprecation(ref d) => op(d).map(Deprecation),
             ItemAttrs(ref d) => op(d).map(ItemAttrs),
+            FnArgNames(ref d) => op(d).map(FnArgNames),
             ItemBodyNestedBodies(ref d) => op(d).map(ItemBodyNestedBodies),
             ConstIsRvaluePromotableToStatic(ref d) => op(d).map(ConstIsRvaluePromotableToStatic),
             IsMirAvailable(ref d) => op(d).map(IsMirAvailable),
index e30b4b2818e5e22e26503a19c6c3e9fa9391e7ba..00904f540617234eec351e0ae4e770b40492cc3d 100644 (file)
@@ -182,7 +182,6 @@ pub trait CrateStore {
     fn visibility(&self, def: DefId) -> ty::Visibility;
     fn visible_parent_map<'a>(&'a self) -> ::std::cell::Ref<'a, DefIdMap<DefId>>;
     fn item_generics_cloned(&self, def: DefId) -> ty::Generics;
-    fn fn_arg_names(&self, did: DefId) -> Vec<ast::Name>;
 
     // trait info
     fn implementations_of_trait(&self, filter: Option<DefId>) -> Vec<DefId>;
@@ -308,7 +307,6 @@ fn visible_parent_map<'a>(&'a self) -> ::std::cell::Ref<'a, DefIdMap<DefId>> {
     }
     fn item_generics_cloned(&self, def: DefId) -> ty::Generics
         { bug!("item_generics_cloned") }
-    fn fn_arg_names(&self, did: DefId) -> Vec<ast::Name> { bug!("fn_arg_names") }
 
     // trait info
     fn implementations_of_trait(&self, filter: Option<DefId>) -> Vec<DefId> { vec![] }
index 948df617867512e0e7179b7b35c6fe5effdaedf1..43f6c94b8b09567a7e464d9545270c63b060fd82 100644 (file)
@@ -341,6 +341,12 @@ fn describe(_: TyCtxt, _: DefId) -> String {
     }
 }
 
+impl<'tcx> QueryDescription for queries::fn_arg_names<'tcx> {
+    fn describe(_: TyCtxt, _: DefId) -> String {
+        bug!("fn_arg_names")
+    }
+}
+
 impl<'tcx> QueryDescription for queries::item_body_nested_bodies<'tcx> {
     fn describe(tcx: TyCtxt, def_id: DefId) -> String {
         format!("nested item bodies of `{}`", tcx.item_path_str(def_id))
@@ -791,6 +797,7 @@ fn default() -> Self {
     [] stability: Stability(DefId) -> Option<attr::Stability>,
     [] deprecation: Deprecation(DefId) -> Option<attr::Deprecation>,
     [] item_attrs: ItemAttrs(DefId) -> Rc<[ast::Attribute]>,
+    [] fn_arg_names: FnArgNames(DefId) -> Vec<ast::Name>,
     [] item_body_nested_bodies: ItemBodyNestedBodies(DefId) -> Rc<BTreeMap<hir::BodyId, hir::Body>>,
     [] const_is_rvalue_promotable_to_static: ConstIsRvaluePromotableToStatic(DefId) -> bool,
     [] is_mir_available: IsMirAvailable(DefId) -> bool,
index c7a52922e2a0997224f41fffc873e5c0fab60446..325ba14da9c8aeb9a712970930eafdfc513fdcdf 100644 (file)
@@ -114,6 +114,11 @@ pub fn provide<$lt>(providers: &mut Providers<$lt>) {
     stability => { cdata.get_stability(def_id.index) }
     deprecation => { cdata.get_deprecation(def_id.index) }
     item_attrs => { cdata.get_item_attrs(def_id.index) }
+    // FIXME(#38501) We've skipped a `read` on the `HirBody` of
+    // a `fn` when encoding, so the dep-tracking wouldn't work.
+    // 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) }
     item_body_nested_bodies => {
         let map: BTreeMap<_, _> = cdata.entry(def_id.index).ast.into_iter().flat_map(|ast| {
             ast.decode(cdata).nested_bodies.decode(cdata).map(|body| (body.id(), body))
@@ -146,16 +151,6 @@ fn item_generics_cloned(&self, def: DefId) -> ty::Generics {
         self.get_crate_data(def.krate).get_generics(def.index)
     }
 
-    fn fn_arg_names(&self, did: DefId) -> Vec<ast::Name>
-    {
-        // FIXME(#38501) We've skipped a `read` on the `HirBody` of
-        // a `fn` when encoding, so the dep-tracking wouldn't work.
-        // This is only used by rustdoc anyway, which shouldn't have
-        // incremental recompilation ever enabled.
-        assert!(!self.dep_graph.is_fully_enabled());
-        self.get_crate_data(did.krate).get_fn_arg_names(did.index)
-    }
-
     fn implementations_of_trait(&self, filter: Option<DefId>) -> Vec<DefId>
     {
         if let Some(def_id) = filter {
index 0a748487244321711d19156f46cc76d7aac13211..78b96e1833b6dbb9c9eed4e2f11b081002b13284 100644 (file)
@@ -1179,7 +1179,7 @@ fn clean(&self, cx: &DocContext) -> FnDecl {
         let mut names = if cx.tcx.hir.as_local_node_id(did).is_some() {
             vec![].into_iter()
         } else {
-            cx.tcx.sess.cstore.fn_arg_names(did).into_iter()
+            cx.tcx.fn_arg_names(did).into_iter()
         }.peekable();
         FnDecl {
             output: Return(sig.skip_binder().output().clean(cx)),