about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorcsmoe <csmoe@msn.com>2019-09-21 03:17:57 +0000
committercsmoe <csmoe@msn.com>2019-09-21 03:17:57 +0000
commita813cc1bf190f9cdcd7dce2eba287c637ce4048f (patch)
tree4ef07df95341cd37db30d0edf139cc2e183fdb75 /src
parent9ffb1ce28cb1656d6142f1f9f6f882eb187fac25 (diff)
downloadrust-a813cc1bf190f9cdcd7dce2eba287c637ce4048f.tar.gz
rust-a813cc1bf190f9cdcd7dce2eba287c637ce4048f.zip
rename is_async_fn to asyncness
Diffstat (limited to 'src')
-rw-r--r--src/librustc/query/mod.rs2
-rw-r--r--src/librustc/ty/mod.rs11
-rw-r--r--src/librustc_metadata/cstore_impl.rs2
-rw-r--r--src/librustc_metadata/decoder.rs7
-rw-r--r--src/librustdoc/clean/inline.rs6
-rw-r--r--src/librustdoc/clean/mod.rs6
6 files changed, 13 insertions, 21 deletions
diff --git a/src/librustc/query/mod.rs b/src/librustc/query/mod.rs
index 5e1db92b555..252e49d5d15 100644
--- a/src/librustc/query/mod.rs
+++ b/src/librustc/query/mod.rs
@@ -244,7 +244,7 @@ rustc_queries! {
             desc { |tcx| "checking if item is const fn: `{}`", tcx.def_path_str(key) }
         }
 
-        query is_async_fn(key: DefId) -> bool {
+        query asyncness(key: DefId) -> hir::IsAsync {
             desc { |tcx| "checking if the function is async: `{}`", tcx.def_path_str(key) }
         }
 
diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs
index 97981f47820..dd36a452092 100644
--- a/src/librustc/ty/mod.rs
+++ b/src/librustc/ty/mod.rs
@@ -3349,16 +3349,17 @@ fn issue33140_self_ty(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Ty<'_>> {
     }
 }
 
-fn is_async_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
+/// Check if a function is async.
+fn asyncness(tcx: TyCtxt<'_>, def_id: DefId) -> hir::IsAsync {
     if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) {
         let node = tcx.hir().get(hir_id);
         if let Some(fn_like) = hir::map::blocks::FnLikeNode::from_node(node) {
-             fn_like.asyncness() == hir::IsAsync::Async
+             fn_like.asyncness()
         } else {
-            false
+            hir::IsAsync::NotAsync
         }
     } else {
-        false
+        hir::IsAsync::NotAsync
     }
 }
 
@@ -3370,7 +3371,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
     util::provide(providers);
     constness::provide(providers);
     *providers = ty::query::Providers {
-        is_async_fn,
+        asyncness,
         associated_item,
         associated_item_def_ids,
         adt_sized_constraint,
diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs
index c46e2a901f8..55cf3965aa8 100644
--- a/src/librustc_metadata/cstore_impl.rs
+++ b/src/librustc_metadata/cstore_impl.rs
@@ -133,7 +133,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
     fn_sig => { cdata.fn_sig(def_id.index, tcx) }
     inherent_impls => { cdata.get_inherent_implementations_for_type(tcx, def_id.index) }
     is_const_fn_raw => { cdata.is_const_fn_raw(def_id.index) }
-    is_async_fn => { cdata.is_async_fn(def_id.index) }
+    asyncness => { cdata.asyncness(def_id.index) }
     is_foreign_item => { cdata.is_foreign_item(def_id.index) }
     static_mutability => { cdata.static_mutability(def_id.index) }
     def_kind => { cdata.def_kind(def_id.index) }
diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs
index 6cc5c409e13..5153564fc82 100644
--- a/src/librustc_metadata/decoder.rs
+++ b/src/librustc_metadata/decoder.rs
@@ -1208,13 +1208,12 @@ impl<'a, 'tcx> CrateMetadata {
         constness == hir::Constness::Const
     }
 
-    pub fn is_async_fn(&self, id: DefIndex) -> bool {
-        let asyncness = match self.entry(id).kind {
+    pub fn asyncness(&self, id: DefIndex) -> hir::IsAsync {
+         match self.entry(id).kind {
             EntryKind::Fn(data) => data.decode(self).asyncness,
             EntryKind::Method(data) => data.decode(self).fn_data.asyncness,
             _ => hir::IsAsync::NotAsync,
-        };
-        asyncness == hir::IsAsync::Async
+        }
     }
 
     pub fn is_foreign_item(&self, id: DefIndex) -> bool {
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs
index 0752934c8c1..d71acb4fa7b 100644
--- a/src/librustdoc/clean/inline.rs
+++ b/src/librustdoc/clean/inline.rs
@@ -217,11 +217,7 @@ fn build_external_function(cx: &DocContext<'_>, did: DefId) -> clean::Function {
     } else {
         hir::Constness::NotConst
     };
-    let asyncness =  if cx.tcx.is_async_fn(did) {
-        hir::IsAsync::Async
-    } else {
-        hir::IsAsync::NotAsync
-    };
+    let asyncness =  cx.tcx.asyncness(did);
     let predicates = cx.tcx.predicates_of(did);
     let (generics, decl) = clean::enter_impl_trait(cx, || {
         ((cx.tcx.generics_of(did), &predicates).clean(cx), (did, sig).clean(cx))
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 7bd54c64cf6..95a5869e845 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -2403,11 +2403,7 @@ impl Clean<Item> for ty::AssocItem {
                     } else {
                         hir::Constness::NotConst
                     };
-                    let asyncness = if cx.tcx.is_async_fn(self.def_id) {
-                        hir::IsAsync::Async
-                    } else {
-                        hir::IsAsync::NotAsync
-                    };
+                    let asyncness = cx.tcx.asyncness(self.def_id);
                     let defaultness = match self.container {
                         ty::ImplContainer(_) => Some(self.defaultness),
                         ty::TraitContainer(_) => None,