about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-10-19 21:46:28 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-10-20 21:14:01 +0000
commitd9259fdedd96d03a9226e899a853c97d391eb94d (patch)
tree081a044591b21e4e835c2dcc22f29d3b0cf72125
parent868e513935876bb9de4ce7e10d9d77ca5612b4a1 (diff)
downloadrust-d9259fdedd96d03a9226e899a853c97d391eb94d.tar.gz
rust-d9259fdedd96d03a9226e899a853c97d391eb94d.zip
s/generator/coroutine/
-rw-r--r--clippy_lints/src/async_yields_async.rs2
-rw-r--r--clippy_lints/src/await_holding_invalid.rs14
-rw-r--r--clippy_lints/src/doc.rs2
-rw-r--r--clippy_lints/src/manual_async_fn.rs2
-rw-r--r--clippy_lints/src/methods/iter_kv_map.rs2
-rw-r--r--clippy_lints/src/needless_question_mark.rs2
-rw-r--r--clippy_lints/src/redundant_async_block.rs2
-rw-r--r--clippy_lints/src/redundant_closure_call.rs4
-rw-r--r--clippy_lints/src/unused_async.rs2
-rw-r--r--clippy_utils/src/qualify_min_const_fn.rs2
-rw-r--r--tests/ui/crashes/ice-5238.rs2
-rw-r--r--tests/ui/large_futures.fixed2
-rw-r--r--tests/ui/large_futures.rs2
13 files changed, 20 insertions, 20 deletions
diff --git a/clippy_lints/src/async_yields_async.rs b/clippy_lints/src/async_yields_async.rs
index 99daec560e7..96a90d599ab 100644
--- a/clippy_lints/src/async_yields_async.rs
+++ b/clippy_lints/src/async_yields_async.rs
@@ -48,7 +48,7 @@ impl<'tcx> LateLintPass<'tcx> for AsyncYieldsAsync {
         use AsyncCoroutineKind::{Block, Closure};
         // For functions, with explicitly defined types, don't warn.
         // XXXkhuey maybe we should?
-        if let Some(CoroutineKind::Async(Block | Closure)) = body.generator_kind {
+        if let Some(CoroutineKind::Async(Block | Closure)) = body.coroutine_kind {
             if let Some(future_trait_def_id) = cx.tcx.lang_items().future_trait() {
                 let body_id = BodyId {
                     hir_id: body.value.hir_id,
diff --git a/clippy_lints/src/await_holding_invalid.rs b/clippy_lints/src/await_holding_invalid.rs
index 65d131c5751..60f9bbd7458 100644
--- a/clippy_lints/src/await_holding_invalid.rs
+++ b/clippy_lints/src/await_holding_invalid.rs
@@ -196,25 +196,25 @@ impl LateLintPass<'_> for AwaitHolding {
 
     fn check_body(&mut self, cx: &LateContext<'_>, body: &'_ Body<'_>) {
         use AsyncCoroutineKind::{Block, Closure, Fn};
-        if let Some(CoroutineKind::Async(Block | Closure | Fn)) = body.generator_kind {
+        if let Some(CoroutineKind::Async(Block | Closure | Fn)) = body.coroutine_kind {
             let def_id = cx.tcx.hir().body_owner_def_id(body.id());
-            if let Some(generator_layout) = cx.tcx.mir_generator_witnesses(def_id) {
-                self.check_interior_types(cx, generator_layout);
+            if let Some(coroutine_layout) = cx.tcx.mir_coroutine_witnesses(def_id) {
+                self.check_interior_types(cx, coroutine_layout);
             }
         }
     }
 }
 
 impl AwaitHolding {
-    fn check_interior_types(&self, cx: &LateContext<'_>, generator: &CoroutineLayout<'_>) {
-        for (ty_index, ty_cause) in generator.field_tys.iter_enumerated() {
+    fn check_interior_types(&self, cx: &LateContext<'_>, coroutine: &CoroutineLayout<'_>) {
+        for (ty_index, ty_cause) in coroutine.field_tys.iter_enumerated() {
             if let rustc_middle::ty::Adt(adt, _) = ty_cause.ty.kind() {
                 let await_points = || {
-                    generator
+                    coroutine
                         .variant_source_info
                         .iter_enumerated()
                         .filter_map(|(variant, source_info)| {
-                            generator.variant_fields[variant]
+                            coroutine.variant_fields[variant]
                                 .raw
                                 .contains(&ty_index)
                                 .then_some(source_info.span)
diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs
index ca9defc2bf3..fc9b381664a 100644
--- a/clippy_lints/src/doc.rs
+++ b/clippy_lints/src/doc.rs
@@ -437,7 +437,7 @@ fn lint_for_missing_headers(
                 let ret_ty = typeck.expr_ty(body.value);
                 if implements_trait(cx, ret_ty, future, &[]);
                 if let ty::Coroutine(_, subs, _) = ret_ty.kind();
-                if is_type_diagnostic_item(cx, subs.as_generator().return_ty(), sym::Result);
+                if is_type_diagnostic_item(cx, subs.as_coroutine().return_ty(), sym::Result);
                 then {
                     span_lint(
                         cx,
diff --git a/clippy_lints/src/manual_async_fn.rs b/clippy_lints/src/manual_async_fn.rs
index 49976334751..914ceca2995 100644
--- a/clippy_lints/src/manual_async_fn.rs
+++ b/clippy_lints/src/manual_async_fn.rs
@@ -188,7 +188,7 @@ fn desugared_async_block<'tcx>(cx: &LateContext<'tcx>, block: &'tcx Block<'tcx>)
             ..
         } = block_expr;
         let closure_body = cx.tcx.hir().body(body);
-        if closure_body.generator_kind == Some(CoroutineKind::Async(AsyncCoroutineKind::Block));
+        if closure_body.coroutine_kind == Some(CoroutineKind::Async(AsyncCoroutineKind::Block));
         then {
             return Some(closure_body);
         }
diff --git a/clippy_lints/src/methods/iter_kv_map.rs b/clippy_lints/src/methods/iter_kv_map.rs
index 674d3451748..b44a2716dde 100644
--- a/clippy_lints/src/methods/iter_kv_map.rs
+++ b/clippy_lints/src/methods/iter_kv_map.rs
@@ -26,7 +26,7 @@ pub(super) fn check<'tcx>(
     if_chain! {
         if !expr.span.from_expansion();
         if let ExprKind::Closure(c) = m_arg.kind;
-        if let Body {params: [p], value: body_expr, generator_kind: _ } = cx.tcx.hir().body(c.body);
+        if let Body {params: [p], value: body_expr, coroutine_kind: _ } = cx.tcx.hir().body(c.body);
         if let PatKind::Tuple([key_pat, val_pat], _) = p.pat.kind;
 
         let (replacement_kind, annotation, bound_ident) = match (&key_pat.kind, &val_pat.kind) {
diff --git a/clippy_lints/src/needless_question_mark.rs b/clippy_lints/src/needless_question_mark.rs
index f2c823323bb..d267b3de7f2 100644
--- a/clippy_lints/src/needless_question_mark.rs
+++ b/clippy_lints/src/needless_question_mark.rs
@@ -87,7 +87,7 @@ impl LateLintPass<'_> for NeedlessQuestionMark {
     }
 
     fn check_body(&mut self, cx: &LateContext<'_>, body: &'_ Body<'_>) {
-        if let Some(CoroutineKind::Async(AsyncCoroutineKind::Fn)) = body.generator_kind {
+        if let Some(CoroutineKind::Async(AsyncCoroutineKind::Fn)) = body.coroutine_kind {
             if let ExprKind::Block(
                 Block {
                     expr:
diff --git a/clippy_lints/src/redundant_async_block.rs b/clippy_lints/src/redundant_async_block.rs
index 59aecd23278..b8f787e1f1f 100644
--- a/clippy_lints/src/redundant_async_block.rs
+++ b/clippy_lints/src/redundant_async_block.rs
@@ -71,7 +71,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantAsyncBlock {
 fn desugar_async_block<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> Option<&'tcx Expr<'tcx>> {
     if let ExprKind::Closure(Closure { body, def_id, .. }) = expr.kind &&
         let body = cx.tcx.hir().body(*body) &&
-        matches!(body.generator_kind, Some(CoroutineKind::Async(AsyncCoroutineKind::Block)))
+        matches!(body.coroutine_kind, Some(CoroutineKind::Async(AsyncCoroutineKind::Block)))
     {
         cx
             .typeck_results()
diff --git a/clippy_lints/src/redundant_closure_call.rs b/clippy_lints/src/redundant_closure_call.rs
index f42836611ca..c18237e887d 100644
--- a/clippy_lints/src/redundant_closure_call.rs
+++ b/clippy_lints/src/redundant_closure_call.rs
@@ -144,7 +144,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClosureCall {
             // without this check, we'd end up linting twice.
             && !matches!(recv.kind, hir::ExprKind::Call(..))
             && let (full_expr, call_depth) = get_parent_call_exprs(cx, expr)
-            && let Some((body, fn_decl, generator_kind)) = find_innermost_closure(cx, recv, call_depth)
+            && let Some((body, fn_decl, coroutine_kind)) = find_innermost_closure(cx, recv, call_depth)
         {
             span_lint_and_then(
                 cx,
@@ -156,7 +156,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClosureCall {
                         let mut applicability = Applicability::MachineApplicable;
                         let mut hint = Sugg::hir_with_context(cx, body, full_expr.span.ctxt(), "..", &mut applicability);
 
-                        if generator_kind.is_async()
+                        if coroutine_kind.is_async()
                             && let hir::ExprKind::Closure(closure) = body.kind
                         {
                             let async_closure_body = cx.tcx.hir().body(closure.body);
diff --git a/clippy_lints/src/unused_async.rs b/clippy_lints/src/unused_async.rs
index 5e1ba1b0dc0..3649f8792ae 100644
--- a/clippy_lints/src/unused_async.rs
+++ b/clippy_lints/src/unused_async.rs
@@ -86,7 +86,7 @@ impl<'a, 'tcx> Visitor<'tcx> for AsyncFnVisitor<'a, 'tcx> {
     }
 
     fn visit_body(&mut self, b: &'tcx Body<'tcx>) {
-        let is_async_block = matches!(b.generator_kind, Some(rustc_hir::CoroutineKind::Async(_)));
+        let is_async_block = matches!(b.coroutine_kind, Some(rustc_hir::CoroutineKind::Async(_)));
 
         if is_async_block {
             self.async_depth += 1;
diff --git a/clippy_utils/src/qualify_min_const_fn.rs b/clippy_utils/src/qualify_min_const_fn.rs
index 0d8fd9d2adf..f6096ea546d 100644
--- a/clippy_utils/src/qualify_min_const_fn.rs
+++ b/clippy_utils/src/qualify_min_const_fn.rs
@@ -306,7 +306,7 @@ fn check_terminator<'tcx>(
         },
         TerminatorKind::SwitchInt { discr, targets: _ } => check_operand(tcx, discr, span, body),
         TerminatorKind::CoroutineDrop | TerminatorKind::Yield { .. } => {
-            Err((span, "const fn generators are unstable".into()))
+            Err((span, "const fn coroutines are unstable".into()))
         },
         TerminatorKind::Call {
             func,
diff --git a/tests/ui/crashes/ice-5238.rs b/tests/ui/crashes/ice-5238.rs
index 989eb6d4485..b1fc3fb9d25 100644
--- a/tests/ui/crashes/ice-5238.rs
+++ b/tests/ui/crashes/ice-5238.rs
@@ -1,6 +1,6 @@
 // Regression test for #5238 / https://github.com/rust-lang/rust/pull/69562
 
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
 
 fn main() {
     let _ = || {
diff --git a/tests/ui/large_futures.fixed b/tests/ui/large_futures.fixed
index 4c192d1c8d1..aa8c3021b97 100644
--- a/tests/ui/large_futures.fixed
+++ b/tests/ui/large_futures.fixed
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
 #![warn(clippy::large_futures)]
 #![allow(clippy::never_loop)]
 #![allow(clippy::future_not_send)]
diff --git a/tests/ui/large_futures.rs b/tests/ui/large_futures.rs
index 557d89a9cf9..fc6ea458d3d 100644
--- a/tests/ui/large_futures.rs
+++ b/tests/ui/large_futures.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
 #![warn(clippy::large_futures)]
 #![allow(clippy::never_loop)]
 #![allow(clippy::future_not_send)]