Skip to content

Commit 868e513

Browse files
committed
s/Generator/Coroutine/
1 parent 214b4d9 commit 868e513

File tree

10 files changed

+20
-20
lines changed

10 files changed

+20
-20
lines changed

clippy_lints/src/async_yields_async.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use clippy_utils::diagnostics::span_lint_hir_and_then;
22
use clippy_utils::source::snippet;
33
use clippy_utils::ty::implements_trait;
44
use rustc_errors::Applicability;
5-
use rustc_hir::{AsyncGeneratorKind, Body, BodyId, ExprKind, GeneratorKind, QPath};
5+
use rustc_hir::{AsyncCoroutineKind, Body, BodyId, ExprKind, CoroutineKind, QPath};
66
use rustc_lint::{LateContext, LateLintPass};
77
use rustc_session::{declare_lint_pass, declare_tool_lint};
88

@@ -45,10 +45,10 @@ declare_lint_pass!(AsyncYieldsAsync => [ASYNC_YIELDS_ASYNC]);
4545

4646
impl<'tcx> LateLintPass<'tcx> for AsyncYieldsAsync {
4747
fn check_body(&mut self, cx: &LateContext<'tcx>, body: &'tcx Body<'_>) {
48-
use AsyncGeneratorKind::{Block, Closure};
48+
use AsyncCoroutineKind::{Block, Closure};
4949
// For functions, with explicitly defined types, don't warn.
5050
// XXXkhuey maybe we should?
51-
if let Some(GeneratorKind::Async(Block | Closure)) = body.generator_kind {
51+
if let Some(CoroutineKind::Async(Block | Closure)) = body.generator_kind {
5252
if let Some(future_trait_def_id) = cx.tcx.lang_items().future_trait() {
5353
let body_id = BodyId {
5454
hir_id: body.value.hir_id,

clippy_lints/src/await_holding_invalid.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use clippy_utils::diagnostics::span_lint_and_then;
22
use clippy_utils::{match_def_path, paths};
33
use rustc_data_structures::fx::FxHashMap;
44
use rustc_hir::def_id::DefId;
5-
use rustc_hir::{AsyncGeneratorKind, Body, GeneratorKind};
5+
use rustc_hir::{AsyncCoroutineKind, Body, CoroutineKind};
66
use rustc_lint::{LateContext, LateLintPass};
7-
use rustc_middle::mir::GeneratorLayout;
7+
use rustc_middle::mir::CoroutineLayout;
88
use rustc_session::{declare_tool_lint, impl_lint_pass};
99
use rustc_span::{sym, Span};
1010

@@ -195,8 +195,8 @@ impl LateLintPass<'_> for AwaitHolding {
195195
}
196196

197197
fn check_body(&mut self, cx: &LateContext<'_>, body: &'_ Body<'_>) {
198-
use AsyncGeneratorKind::{Block, Closure, Fn};
199-
if let Some(GeneratorKind::Async(Block | Closure | Fn)) = body.generator_kind {
198+
use AsyncCoroutineKind::{Block, Closure, Fn};
199+
if let Some(CoroutineKind::Async(Block | Closure | Fn)) = body.generator_kind {
200200
let def_id = cx.tcx.hir().body_owner_def_id(body.id());
201201
if let Some(generator_layout) = cx.tcx.mir_generator_witnesses(def_id) {
202202
self.check_interior_types(cx, generator_layout);
@@ -206,7 +206,7 @@ impl LateLintPass<'_> for AwaitHolding {
206206
}
207207

208208
impl AwaitHolding {
209-
fn check_interior_types(&self, cx: &LateContext<'_>, generator: &GeneratorLayout<'_>) {
209+
fn check_interior_types(&self, cx: &LateContext<'_>, generator: &CoroutineLayout<'_>) {
210210
for (ty_index, ty_cause) in generator.field_tys.iter_enumerated() {
211211
if let rustc_middle::ty::Adt(adt, _) = ty_cause.ty.kind() {
212212
let await_points = || {

clippy_lints/src/dereference.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,8 +842,8 @@ impl TyCoercionStability {
842842
| ty::Adt(..)
843843
| ty::Foreign(_)
844844
| ty::FnDef(..)
845-
| ty::Generator(..)
846-
| ty::GeneratorWitness(..)
845+
| ty::Coroutine(..)
846+
| ty::CoroutineWitness(..)
847847
| ty::Closure(..)
848848
| ty::Never
849849
| ty::Tuple(_)

clippy_lints/src/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ fn lint_for_missing_headers(
436436
let body = cx.tcx.hir().body(body_id);
437437
let ret_ty = typeck.expr_ty(body.value);
438438
if implements_trait(cx, ret_ty, future, &[]);
439-
if let ty::Generator(_, subs, _) = ret_ty.kind();
439+
if let ty::Coroutine(_, subs, _) = ret_ty.kind();
440440
if is_type_diagnostic_item(cx, subs.as_generator().return_ty(), sym::Result);
441441
then {
442442
span_lint(

clippy_lints/src/large_futures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ declare_clippy_lint! {
1212
/// It checks for the size of a `Future` created by `async fn` or `async {}`.
1313
///
1414
/// ### Why is this bad?
15-
/// Due to the current [unideal implementation](https://github.com/rust-lang/rust/issues/69826) of `Generator`,
15+
/// Due to the current [unideal implementation](https://github.com/rust-lang/rust/issues/69826) of `Coroutine`,
1616
/// large size of a `Future` may cause stack overflows.
1717
///
1818
/// ### Example

clippy_lints/src/manual_async_fn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use if_chain::if_chain;
44
use rustc_errors::Applicability;
55
use rustc_hir::intravisit::FnKind;
66
use rustc_hir::{
7-
AsyncGeneratorKind, Block, Body, Closure, Expr, ExprKind, FnDecl, FnRetTy, GeneratorKind, GenericArg, GenericBound,
7+
AsyncCoroutineKind, Block, Body, Closure, Expr, ExprKind, FnDecl, FnRetTy, CoroutineKind, GenericArg, GenericBound,
88
ImplItem, Item, ItemKind, LifetimeName, Node, Term, TraitRef, Ty, TyKind, TypeBindingKind,
99
};
1010
use rustc_lint::{LateContext, LateLintPass};
@@ -188,7 +188,7 @@ fn desugared_async_block<'tcx>(cx: &LateContext<'tcx>, block: &'tcx Block<'tcx>)
188188
..
189189
} = block_expr;
190190
let closure_body = cx.tcx.hir().body(body);
191-
if closure_body.generator_kind == Some(GeneratorKind::Async(AsyncGeneratorKind::Block));
191+
if closure_body.generator_kind == Some(CoroutineKind::Async(AsyncCoroutineKind::Block));
192192
then {
193193
return Some(closure_body);
194194
}

clippy_lints/src/needless_question_mark.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use clippy_utils::source::snippet;
44
use if_chain::if_chain;
55
use rustc_errors::Applicability;
66
use rustc_hir::def::{DefKind, Res};
7-
use rustc_hir::{AsyncGeneratorKind, Block, Body, Expr, ExprKind, GeneratorKind, LangItem, MatchSource, QPath};
7+
use rustc_hir::{AsyncCoroutineKind, Block, Body, Expr, ExprKind, CoroutineKind, LangItem, MatchSource, QPath};
88
use rustc_lint::{LateContext, LateLintPass};
99
use rustc_session::{declare_lint_pass, declare_tool_lint};
1010

@@ -87,7 +87,7 @@ impl LateLintPass<'_> for NeedlessQuestionMark {
8787
}
8888

8989
fn check_body(&mut self, cx: &LateContext<'_>, body: &'_ Body<'_>) {
90-
if let Some(GeneratorKind::Async(AsyncGeneratorKind::Fn)) = body.generator_kind {
90+
if let Some(CoroutineKind::Async(AsyncCoroutineKind::Fn)) = body.generator_kind {
9191
if let ExprKind::Block(
9292
Block {
9393
expr:

clippy_lints/src/redundant_async_block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use clippy_utils::peel_blocks;
55
use clippy_utils::source::{snippet, walk_span_to_context};
66
use clippy_utils::visitors::for_each_expr;
77
use rustc_errors::Applicability;
8-
use rustc_hir::{AsyncGeneratorKind, Closure, Expr, ExprKind, GeneratorKind, MatchSource};
8+
use rustc_hir::{AsyncCoroutineKind, Closure, Expr, ExprKind, CoroutineKind, MatchSource};
99
use rustc_lint::{LateContext, LateLintPass};
1010
use rustc_middle::lint::in_external_macro;
1111
use rustc_middle::ty::UpvarCapture;
@@ -71,7 +71,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantAsyncBlock {
7171
fn desugar_async_block<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> Option<&'tcx Expr<'tcx>> {
7272
if let ExprKind::Closure(Closure { body, def_id, .. }) = expr.kind &&
7373
let body = cx.tcx.hir().body(*body) &&
74-
matches!(body.generator_kind, Some(GeneratorKind::Async(AsyncGeneratorKind::Block)))
74+
matches!(body.generator_kind, Some(CoroutineKind::Async(AsyncCoroutineKind::Block)))
7575
{
7676
cx
7777
.typeck_results()

clippy_lints/src/unused_async.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<'a, 'tcx> Visitor<'tcx> for AsyncFnVisitor<'a, 'tcx> {
8686
}
8787

8888
fn visit_body(&mut self, b: &'tcx Body<'tcx>) {
89-
let is_async_block = matches!(b.generator_kind, Some(rustc_hir::GeneratorKind::Async(_)));
89+
let is_async_block = matches!(b.generator_kind, Some(rustc_hir::CoroutineKind::Async(_)));
9090

9191
if is_async_block {
9292
self.async_depth += 1;

clippy_utils/src/qualify_min_const_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ fn check_terminator<'tcx>(
305305
Ok(())
306306
},
307307
TerminatorKind::SwitchInt { discr, targets: _ } => check_operand(tcx, discr, span, body),
308-
TerminatorKind::GeneratorDrop | TerminatorKind::Yield { .. } => {
308+
TerminatorKind::CoroutineDrop | TerminatorKind::Yield { .. } => {
309309
Err((span, "const fn generators are unstable".into()))
310310
},
311311
TerminatorKind::Call {

0 commit comments

Comments
 (0)