diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-10-19 21:46:28 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-10-20 21:14:01 +0000 |
| commit | e96ce20b34789d29e925425da6cf138927b80a79 (patch) | |
| tree | 4032e01ddd5137d1ee98b69277953f2962bbf14b /compiler/rustc_hir/src | |
| parent | 60956837cfbf22bd8edd80f57a856e141f7deb8c (diff) | |
| download | rust-e96ce20b34789d29e925425da6cf138927b80a79.tar.gz rust-e96ce20b34789d29e925425da6cf138927b80a79.zip | |
s/generator/coroutine/
Diffstat (limited to 'compiler/rustc_hir/src')
| -rw-r--r-- | compiler/rustc_hir/src/def.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/hir.rs | 24 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/intravisit.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/lang_items.rs | 4 |
4 files changed, 18 insertions, 18 deletions
diff --git a/compiler/rustc_hir/src/def.rs b/compiler/rustc_hir/src/def.rs index 3c7d158c9ad..ed1dc751fba 100644 --- a/compiler/rustc_hir/src/def.rs +++ b/compiler/rustc_hir/src/def.rs @@ -126,7 +126,7 @@ impl DefKind { /// /// If you have access to `TyCtxt`, use `TyCtxt::def_descr` or /// `TyCtxt::def_kind_descr` instead, because they give better - /// information for generators and associated functions. + /// information for coroutines and associated functions. pub fn descr(self, def_id: DefId) -> &'static str { match self { DefKind::Fn => "function", @@ -161,7 +161,7 @@ impl DefKind { DefKind::Field => "field", DefKind::Impl { .. } => "implementation", DefKind::Closure => "closure", - DefKind::Coroutine => "generator", + DefKind::Coroutine => "coroutine", DefKind::ExternCrate => "extern crate", DefKind::GlobalAsm => "global assembly block", } @@ -171,7 +171,7 @@ impl DefKind { /// /// If you have access to `TyCtxt`, use `TyCtxt::def_descr_article` or /// `TyCtxt::def_kind_descr_article` instead, because they give better - /// information for generators and associated functions. + /// information for coroutines and associated functions. pub fn article(&self) -> &'static str { match *self { DefKind::AssocTy diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index f60e312937c..cace819c890 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -1485,7 +1485,7 @@ pub struct BodyId { /// /// - an `params` array containing the `(x, y)` pattern /// - a `value` containing the `x + y` expression (maybe wrapped in a block) -/// - `generator_kind` would be `None` +/// - `coroutine_kind` would be `None` /// /// All bodies have an **owner**, which can be accessed via the HIR /// map using `body_owner_def_id()`. @@ -1493,7 +1493,7 @@ pub struct BodyId { pub struct Body<'hir> { pub params: &'hir [Param<'hir>], pub value: &'hir Expr<'hir>, - pub generator_kind: Option<CoroutineKind>, + pub coroutine_kind: Option<CoroutineKind>, } impl<'hir> Body<'hir> { @@ -1501,19 +1501,19 @@ impl<'hir> Body<'hir> { BodyId { hir_id: self.value.hir_id } } - pub fn generator_kind(&self) -> Option<CoroutineKind> { - self.generator_kind + pub fn coroutine_kind(&self) -> Option<CoroutineKind> { + self.coroutine_kind } } -/// The type of source expression that caused this generator to be created. +/// The type of source expression that caused this coroutine to be created. #[derive(Clone, PartialEq, Eq, Debug, Copy, Hash)] #[derive(HashStable_Generic, Encodable, Decodable)] pub enum CoroutineKind { /// An explicit `async` block or the body of an async function. Async(AsyncCoroutineKind), - /// A generator literal created via a `yield` inside a closure. + /// A coroutine literal created via a `yield` inside a closure. Gen, } @@ -1521,7 +1521,7 @@ 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("generator"), + CoroutineKind::Gen => f.write_str("coroutine"), } } } @@ -1530,12 +1530,12 @@ impl CoroutineKind { pub fn descr(&self) -> &'static str { match self { CoroutineKind::Async(ask) => ask.descr(), - CoroutineKind::Gen => "generator", + CoroutineKind::Gen => "coroutine", } } } -/// In the case of a generator created as part of an async construct, +/// In the case of a coroutine created as part of an async construct, /// which kind of async construct caused it to be created? /// /// This helps error messages but is also used to drive coercions in @@ -2004,7 +2004,7 @@ pub enum ExprKind<'hir> { /// /// The `Span` is the argument block `|...|`. /// - /// This may also be a generator literal or an `async block` as indicated by the + /// This may also be a coroutine literal or an `async block` as indicated by the /// `Option<Movability>`. Closure(&'hir Closure<'hir>), /// A block (e.g., `'label: { ... }`). @@ -2055,7 +2055,7 @@ pub enum ExprKind<'hir> { /// to be repeated; the second is the number of times to repeat it. Repeat(&'hir Expr<'hir>, ArrayLen), - /// A suspension point for generators (i.e., `yield <expr>`). + /// A suspension point for coroutines (i.e., `yield <expr>`). Yield(&'hir Expr<'hir>, YieldSource), /// A placeholder for an expression that wasn't syntactically well formed in some way. @@ -2250,7 +2250,7 @@ impl fmt::Display for YieldSource { impl From<CoroutineKind> for YieldSource { fn from(kind: CoroutineKind) -> Self { match kind { - // Guess based on the kind of the current generator. + // Guess based on the kind of the current coroutine. CoroutineKind::Gen => Self::Yield, CoroutineKind::Async(_) => Self::Await { expr: None }, } diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs index d9195a374c2..8a672855989 100644 --- a/compiler/rustc_hir/src/intravisit.rs +++ b/compiler/rustc_hir/src/intravisit.rs @@ -62,7 +62,7 @@ //! respectively. (This follows from RPO respecting CFG domination). //! //! This order consistency is required in a few places in rustc, for -//! example generator inference, and possibly also HIR borrowck. +//! example coroutine inference, and possibly also HIR borrowck. use crate::hir::*; use rustc_ast::walk_list; diff --git a/compiler/rustc_hir/src/lang_items.rs b/compiler/rustc_hir/src/lang_items.rs index b13eb3b5e7a..cdfc67d5740 100644 --- a/compiler/rustc_hir/src/lang_items.rs +++ b/compiler/rustc_hir/src/lang_items.rs @@ -211,8 +211,8 @@ language_item_table! { FnOnceOutput, sym::fn_once_output, fn_once_output, Target::AssocTy, GenericRequirement::None; Future, sym::future_trait, future_trait, Target::Trait, GenericRequirement::Exact(0); - CoroutineState, sym::generator_state, gen_state, Target::Enum, GenericRequirement::None; - Coroutine, sym::generator, gen_trait, Target::Trait, GenericRequirement::Minimum(1); + CoroutineState, sym::coroutine_state, gen_state, Target::Enum, GenericRequirement::None; + Coroutine, sym::coroutine, gen_trait, Target::Trait, GenericRequirement::Minimum(1); Unpin, sym::unpin, unpin_trait, Target::Trait, GenericRequirement::None; Pin, sym::pin, pin_type, Target::Struct, GenericRequirement::None; |
