about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/def_collector.rs
diff options
context:
space:
mode:
authorEric Holk <ericholk@microsoft.com>2023-11-30 16:39:56 -0800
committerEric Holk <ericholk@microsoft.com>2023-12-04 13:03:37 -0800
commitf9d1f922dcd335e534d40923ab54088c07a5403e (patch)
treec268e5049e6492ebdbe081b049c562b51031d799 /compiler/rustc_resolve/src/def_collector.rs
parent48d5f1f0f26b78f76c5fcf0dda5ac93b8754aeb6 (diff)
downloadrust-f9d1f922dcd335e534d40923ab54088c07a5403e.tar.gz
rust-f9d1f922dcd335e534d40923ab54088c07a5403e.zip
Option<CoroutineKind>
Diffstat (limited to 'compiler/rustc_resolve/src/def_collector.rs')
-rw-r--r--compiler/rustc_resolve/src/def_collector.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_resolve/src/def_collector.rs b/compiler/rustc_resolve/src/def_collector.rs
index c43ec99f42a..ab5d3b368eb 100644
--- a/compiler/rustc_resolve/src/def_collector.rs
+++ b/compiler/rustc_resolve/src/def_collector.rs
@@ -156,9 +156,9 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> {
 
     fn visit_fn(&mut self, fn_kind: FnKind<'a>, span: Span, _: NodeId) {
         if let FnKind::Fn(_, _, sig, _, generics, body) = fn_kind {
-            // FIXME(eholk): handle `async gen fn`
-            if let CoroutineKind::Async { closure_id, .. } | CoroutineKind::Gen { closure_id, .. } =
-                sig.header.coro_kind
+            if let Some(
+                CoroutineKind::Async { closure_id, .. } | CoroutineKind::Gen { closure_id, .. },
+            ) = sig.header.coro_kind
             {
                 self.visit_generics(generics);
 
@@ -285,11 +285,11 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> {
                 // we must create two defs.
                 let closure_def = self.create_def(expr.id, kw::Empty, DefKind::Closure, expr.span);
                 match closure.coro_kind {
-                    CoroutineKind::Async { closure_id, .. }
-                    | CoroutineKind::Gen { closure_id, .. } => {
-                        self.create_def(closure_id, kw::Empty, DefKind::Closure, expr.span)
-                    }
-                    CoroutineKind::None => closure_def,
+                    Some(
+                        CoroutineKind::Async { closure_id, .. }
+                        | CoroutineKind::Gen { closure_id, .. },
+                    ) => self.create_def(closure_id, kw::Empty, DefKind::Closure, expr.span),
+                    None => closure_def,
                 }
             }
             ExprKind::Gen(_, _, _) => {