about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-10-20 09:02:22 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-10-20 21:14:01 +0000
commit2d91c76d5dba082f6951eca6f8f694dff90c3607 (patch)
tree5b78aa9fd0d69b270368a4a6e0542729cc104aad
parente96ce20b34789d29e925425da6cf138927b80a79 (diff)
downloadrust-2d91c76d5dba082f6951eca6f8f694dff90c3607.tar.gz
rust-2d91c76d5dba082f6951eca6f8f694dff90c3607.zip
Rename `CoroutineKind::Gen` to `::Coroutine`
-rw-r--r--compiler/rustc_ast_lowering/src/expr.rs8
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs2
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/region_name.rs2
-rw-r--r--compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs2
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/check.rs2
-rw-r--r--compiler/rustc_hir/src/hir.rs8
-rw-r--r--compiler/rustc_hir_typeck/src/check.rs2
-rw-r--r--compiler/rustc_middle/src/mir/terminator.rs12
-rw-r--r--compiler/rustc_middle/src/ty/print/pretty.rs2
-rw-r--r--compiler/rustc_middle/src/ty/util.rs4
-rw-r--r--compiler/rustc_smir/src/rustc_smir/mod.rs2
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs4
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs2
-rw-r--r--compiler/stable_mir/src/mir/body.rs2
14 files changed, 29 insertions, 25 deletions
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs
index 82db30bd05e..4f1b13870fd 100644
--- a/compiler/rustc_ast_lowering/src/expr.rs
+++ b/compiler/rustc_ast_lowering/src/expr.rs
@@ -712,7 +712,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
         let full_span = expr.span.to(await_kw_span);
         match self.coroutine_kind {
             Some(hir::CoroutineKind::Async(_)) => {}
-            Some(hir::CoroutineKind::Gen) | None => {
+            Some(hir::CoroutineKind::Coroutine) | None => {
                 self.tcx.sess.emit_err(AwaitOnlyInAsyncFnAndBlocks {
                     await_kw_span,
                     item_span: self.current_item,
@@ -930,7 +930,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
         movability: Movability,
     ) -> Option<hir::Movability> {
         match coroutine_kind {
-            Some(hir::CoroutineKind::Gen) => {
+            Some(hir::CoroutineKind::Coroutine) => {
                 if decl.inputs.len() > 1 {
                     self.tcx.sess.emit_err(CoroutineTooManyParameters { fn_decl_span });
                 }
@@ -1445,11 +1445,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
 
     fn lower_expr_yield(&mut self, span: Span, opt_expr: Option<&Expr>) -> hir::ExprKind<'hir> {
         match self.coroutine_kind {
-            Some(hir::CoroutineKind::Gen) => {}
+            Some(hir::CoroutineKind::Coroutine) => {}
             Some(hir::CoroutineKind::Async(_)) => {
                 self.tcx.sess.emit_err(AsyncCoroutinesNotSupported { span });
             }
-            None => self.coroutine_kind = Some(hir::CoroutineKind::Gen),
+            None => self.coroutine_kind = Some(hir::CoroutineKind::Coroutine),
         }
 
         let expr =
diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
index 3b640cafb7a..00816c0f253 100644
--- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
@@ -2488,7 +2488,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
                     AsyncCoroutineKind::Closure => "async closure",
                     _ => bug!("async block/closure expected, but async function found."),
                 },
-                CoroutineKind::Gen => "coroutine",
+                CoroutineKind::Coroutine => "coroutine",
             },
             None => "closure",
         };
diff --git a/compiler/rustc_borrowck/src/diagnostics/region_name.rs b/compiler/rustc_borrowck/src/diagnostics/region_name.rs
index b35662a1332..de9ece3faba 100644
--- a/compiler/rustc_borrowck/src/diagnostics/region_name.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/region_name.rs
@@ -698,7 +698,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
                             " of async function"
                         }
                     },
-                    Some(hir::CoroutineKind::Gen) => " of coroutine",
+                    Some(hir::CoroutineKind::Coroutine) => " of coroutine",
                     None => " of closure",
                 };
                 (span, mir_description, hir_ty)
diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
index aad6916ec91..e401f6bbcbf 100644
--- a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
+++ b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
@@ -563,7 +563,7 @@ fn coroutine_kind_label(coroutine_kind: Option<CoroutineKind>) -> &'static str {
         Some(CoroutineKind::Async(AsyncCoroutineKind::Block)) => "async_block",
         Some(CoroutineKind::Async(AsyncCoroutineKind::Closure)) => "async_closure",
         Some(CoroutineKind::Async(AsyncCoroutineKind::Fn)) => "async_fn",
-        Some(CoroutineKind::Gen) => "coroutine",
+        Some(CoroutineKind::Coroutine) => "coroutine",
         None => "closure",
     }
 }
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
index ade1d5726b3..135c99fefbc 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
@@ -1043,7 +1043,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
             TerminatorKind::InlineAsm { .. } => self.check_op(ops::InlineAsm),
 
             TerminatorKind::CoroutineDrop | TerminatorKind::Yield { .. } => {
-                self.check_op(ops::Coroutine(hir::CoroutineKind::Gen))
+                self.check_op(ops::Coroutine(hir::CoroutineKind::Coroutine))
             }
 
             TerminatorKind::UnwindTerminate(_) => {
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs
index cace819c890..f8d55192a37 100644
--- a/compiler/rustc_hir/src/hir.rs
+++ b/compiler/rustc_hir/src/hir.rs
@@ -1514,14 +1514,14 @@ pub enum CoroutineKind {
     Async(AsyncCoroutineKind),
 
     /// A coroutine literal created via a `yield` inside a closure.
-    Gen,
+    Coroutine,
 }
 
 impl fmt::Display for CoroutineKind {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match self {
             CoroutineKind::Async(k) => fmt::Display::fmt(k, f),
-            CoroutineKind::Gen => f.write_str("coroutine"),
+            CoroutineKind::Coroutine => f.write_str("coroutine"),
         }
     }
 }
@@ -1530,7 +1530,7 @@ impl CoroutineKind {
     pub fn descr(&self) -> &'static str {
         match self {
             CoroutineKind::Async(ask) => ask.descr(),
-            CoroutineKind::Gen => "coroutine",
+            CoroutineKind::Coroutine => "coroutine",
         }
     }
 }
@@ -2251,7 +2251,7 @@ impl From<CoroutineKind> for YieldSource {
     fn from(kind: CoroutineKind) -> Self {
         match kind {
             // Guess based on the kind of the current coroutine.
-            CoroutineKind::Gen => Self::Yield,
+            CoroutineKind::Coroutine => Self::Yield,
             CoroutineKind::Async(_) => Self::Await { expr: None },
         }
     }
diff --git a/compiler/rustc_hir_typeck/src/check.rs b/compiler/rustc_hir_typeck/src/check.rs
index 1fb1eb9dbc4..e7060dac844 100644
--- a/compiler/rustc_hir_typeck/src/check.rs
+++ b/compiler/rustc_hir_typeck/src/check.rs
@@ -58,7 +58,7 @@ pub(super) fn check_fn<'a, 'tcx>(
     if let Some(kind) = body.coroutine_kind
         && can_be_coroutine.is_some()
     {
-        let yield_ty = if kind == hir::CoroutineKind::Gen {
+        let yield_ty = if kind == hir::CoroutineKind::Coroutine {
             let yield_ty = fcx.next_ty_var(TypeVariableOrigin {
                 kind: TypeVariableOriginKind::TypeInference,
                 span,
diff --git a/compiler/rustc_middle/src/mir/terminator.rs b/compiler/rustc_middle/src/mir/terminator.rs
index 9a85b671d9d..e3d346c0698 100644
--- a/compiler/rustc_middle/src/mir/terminator.rs
+++ b/compiler/rustc_middle/src/mir/terminator.rs
@@ -139,9 +139,9 @@ impl<O> AssertKind<O> {
             Overflow(op, _, _) => bug!("{:?} cannot overflow", op),
             DivisionByZero(_) => "attempt to divide by zero",
             RemainderByZero(_) => "attempt to calculate the remainder with a divisor of zero",
-            ResumedAfterReturn(CoroutineKind::Gen) => "coroutine resumed after completion",
+            ResumedAfterReturn(CoroutineKind::Coroutine) => "coroutine resumed after completion",
             ResumedAfterReturn(CoroutineKind::Async(_)) => "`async fn` resumed after completion",
-            ResumedAfterPanic(CoroutineKind::Gen) => "coroutine resumed after panicking",
+            ResumedAfterPanic(CoroutineKind::Coroutine) => "coroutine resumed after panicking",
             ResumedAfterPanic(CoroutineKind::Async(_)) => "`async fn` resumed after panicking",
             BoundsCheck { .. } | MisalignedPointerDereference { .. } => {
                 bug!("Unexpected AssertKind")
@@ -229,9 +229,13 @@ impl<O> AssertKind<O> {
             DivisionByZero(_) => middle_assert_divide_by_zero,
             RemainderByZero(_) => middle_assert_remainder_by_zero,
             ResumedAfterReturn(CoroutineKind::Async(_)) => middle_assert_async_resume_after_return,
-            ResumedAfterReturn(CoroutineKind::Gen) => middle_assert_coroutine_resume_after_return,
+            ResumedAfterReturn(CoroutineKind::Coroutine) => {
+                middle_assert_coroutine_resume_after_return
+            }
             ResumedAfterPanic(CoroutineKind::Async(_)) => middle_assert_async_resume_after_panic,
-            ResumedAfterPanic(CoroutineKind::Gen) => middle_assert_coroutine_resume_after_panic,
+            ResumedAfterPanic(CoroutineKind::Coroutine) => {
+                middle_assert_coroutine_resume_after_panic
+            }
 
             MisalignedPointerDereference { .. } => middle_assert_misaligned_ptr_deref,
         }
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
index 1836f3c1a4b..38b3096f851 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -788,7 +788,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
                 p!(write("{{"));
                 let coroutine_kind = self.tcx().coroutine_kind(did).unwrap();
                 let should_print_movability =
-                    self.should_print_verbose() || coroutine_kind == hir::CoroutineKind::Gen;
+                    self.should_print_verbose() || coroutine_kind == hir::CoroutineKind::Coroutine;
 
                 if should_print_movability {
                     match movability {
diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs
index 41968ae75bd..be48c0e8926 100644
--- a/compiler/rustc_middle/src/ty/util.rs
+++ b/compiler/rustc_middle/src/ty/util.rs
@@ -748,7 +748,7 @@ impl<'tcx> TyCtxt<'tcx> {
             DefKind::AssocFn if self.associated_item(def_id).fn_has_self_parameter => "method",
             DefKind::Coroutine => match self.coroutine_kind(def_id).unwrap() {
                 rustc_hir::CoroutineKind::Async(..) => "async closure",
-                rustc_hir::CoroutineKind::Gen => "coroutine",
+                rustc_hir::CoroutineKind::Coroutine => "coroutine",
             },
             _ => def_kind.descr(def_id),
         }
@@ -765,7 +765,7 @@ impl<'tcx> TyCtxt<'tcx> {
             DefKind::AssocFn if self.associated_item(def_id).fn_has_self_parameter => "a",
             DefKind::Coroutine => match self.coroutine_kind(def_id).unwrap() {
                 rustc_hir::CoroutineKind::Async(..) => "an",
-                rustc_hir::CoroutineKind::Gen => "a",
+                rustc_hir::CoroutineKind::Coroutine => "a",
             },
             _ => def_kind.article(),
         }
diff --git a/compiler/rustc_smir/src/rustc_smir/mod.rs b/compiler/rustc_smir/src/rustc_smir/mod.rs
index 0fc25aac3de..8a1b6b6bfe9 100644
--- a/compiler/rustc_smir/src/rustc_smir/mod.rs
+++ b/compiler/rustc_smir/src/rustc_smir/mod.rs
@@ -873,7 +873,7 @@ impl<'tcx> Stable<'tcx> for rustc_hir::CoroutineKind {
                 };
                 stable_mir::mir::CoroutineKind::Async(async_gen)
             }
-            CoroutineKind::Gen => stable_mir::mir::CoroutineKind::Gen,
+            CoroutineKind::Coroutine => stable_mir::mir::CoroutineKind::Coroutine,
         }
     }
 }
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
index 6f9288694a3..86328cb78ab 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -2409,7 +2409,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
             let message = outer_coroutine
                 .and_then(|coroutine_did| {
                     Some(match self.tcx.coroutine_kind(coroutine_did).unwrap() {
-                        CoroutineKind::Gen => format!("coroutine is not {trait_name}"),
+                        CoroutineKind::Coroutine => format!("coroutine is not {trait_name}"),
                         CoroutineKind::Async(AsyncCoroutineKind::Fn) => self
                             .tcx
                             .parent(coroutine_did)
@@ -2882,7 +2882,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
             }
             ObligationCauseCode::SizedCoroutineInterior(coroutine_def_id) => {
                 let what = match self.tcx.coroutine_kind(coroutine_def_id) {
-                    None | Some(hir::CoroutineKind::Gen) => "yield",
+                    None | Some(hir::CoroutineKind::Coroutine) => "yield",
                     Some(hir::CoroutineKind::Async(..)) => "await",
                 };
                 err.note(format!(
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs
index 83d7b502216..b382474213e 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs
@@ -1615,7 +1615,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
 
     fn describe_coroutine(&self, body_id: hir::BodyId) -> Option<&'static str> {
         self.tcx.hir().body(body_id).coroutine_kind.map(|gen_kind| match gen_kind {
-            hir::CoroutineKind::Gen => "a coroutine",
+            hir::CoroutineKind::Coroutine => "a coroutine",
             hir::CoroutineKind::Async(hir::AsyncCoroutineKind::Block) => "an async block",
             hir::CoroutineKind::Async(hir::AsyncCoroutineKind::Fn) => "an async function",
             hir::CoroutineKind::Async(hir::AsyncCoroutineKind::Closure) => "an async closure",
diff --git a/compiler/stable_mir/src/mir/body.rs b/compiler/stable_mir/src/mir/body.rs
index 9e73dd968ff..ea30fe6dbcd 100644
--- a/compiler/stable_mir/src/mir/body.rs
+++ b/compiler/stable_mir/src/mir/body.rs
@@ -134,7 +134,7 @@ pub enum UnOp {
 #[derive(Clone, Debug)]
 pub enum CoroutineKind {
     Async(AsyncCoroutineKind),
-    Gen,
+    Coroutine,
 }
 
 #[derive(Clone, Debug)]