about summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/rmeta
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-26 04:25:53 +0000
committerbors <bors@rust-lang.org>2023-12-26 04:25:53 +0000
commit1ab783112ab4e4807304dbd249b39771246013ef (patch)
tree827d6051e0e3ffcaadd0d6c7369b71547319a525 /compiler/rustc_metadata/src/rmeta
parent2271c26e4a8e062bb00d709d0ccb5846e0c341b9 (diff)
parentba912855cc1aff5f2b403411c8d890d3978abf9a (diff)
downloadrust-1ab783112ab4e4807304dbd249b39771246013ef.tar.gz
rust-1ab783112ab4e4807304dbd249b39771246013ef.zip
Auto merge of #119258 - compiler-errors:closure-kind, r=eholk
Make closures carry their own ClosureKind

Right now, we use the "`movability`" field of `hir::Closure` to distinguish a closure and a coroutine. This is paired together with the `CoroutineKind`, which is located not in the `hir::Closure`, but the `hir::Body`. This is strange and redundant.

This PR introduces `ClosureKind` with two variants -- `Closure` and `Coroutine`, which is put into `hir::Closure`. The `CoroutineKind` is thus removed from `hir::Body`, and `Option<Movability>` no longer needs to be a stand-in for "is this a closure or a coroutine".

r? eholk
Diffstat (limited to 'compiler/rustc_metadata/src/rmeta')
-rw-r--r--compiler/rustc_metadata/src/rmeta/table.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/table.rs b/compiler/rustc_metadata/src/rmeta/table.rs
index 916ff469e09..306bf07a976 100644
--- a/compiler/rustc_metadata/src/rmeta/table.rs
+++ b/compiler/rustc_metadata/src/rmeta/table.rs
@@ -199,7 +199,8 @@ fixed_size_enum! {
 
 fixed_size_enum! {
     hir::CoroutineKind {
-        ( Coroutine                                                                    )
+        ( Coroutine(hir::Movability::Movable)                                          )
+        ( Coroutine(hir::Movability::Static)                                           )
         ( Desugared(hir::CoroutineDesugaring::Gen, hir::CoroutineSource::Block)        )
         ( Desugared(hir::CoroutineDesugaring::Gen, hir::CoroutineSource::Fn)           )
         ( Desugared(hir::CoroutineDesugaring::Gen, hir::CoroutineSource::Closure)      )