about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-03-29 23:50:01 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2022-04-10 13:08:36 +0200
commitdb03a2deb090d5c24f15ef30cf4e5ccb13690b9d (patch)
tree0658d8e510c686e9554992b8013f977d71ce8c3e /compiler/rustc_ty_utils
parent341883d051ebbfaa6daa456b198d557fa0272b71 (diff)
downloadrust-db03a2deb090d5c24f15ef30cf4e5ccb13690b9d.tar.gz
rust-db03a2deb090d5c24f15ef30cf4e5ccb13690b9d.zip
Avoid accessing HIR from MIR queries.
Diffstat (limited to 'compiler/rustc_ty_utils')
-rw-r--r--compiler/rustc_ty_utils/src/ty.rs7
1 files changed, 1 insertions, 6 deletions
diff --git a/compiler/rustc_ty_utils/src/ty.rs b/compiler/rustc_ty_utils/src/ty.rs
index 64145bbf189..6ad71bdb481 100644
--- a/compiler/rustc_ty_utils/src/ty.rs
+++ b/compiler/rustc_ty_utils/src/ty.rs
@@ -414,12 +414,7 @@ fn issue33140_self_ty(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Ty<'_>> {
 /// Check if a function is async.
 fn asyncness(tcx: TyCtxt<'_>, def_id: DefId) -> hir::IsAsync {
     let node = tcx.hir().get_by_def_id(def_id.expect_local());
-
-    let fn_kind = node.fn_kind().unwrap_or_else(|| {
-        bug!("asyncness: expected fn-like node but got `{:?}`", def_id);
-    });
-
-    fn_kind.asyncness()
+    if let Some(fn_kind) = node.fn_kind() { fn_kind.asyncness() } else { hir::IsAsync::NotAsync }
 }
 
 /// Don't call this directly: use ``tcx.conservative_is_privately_uninhabited`` instead.