Skip to content

Commit d9259fd

Browse files
committed
s/generator/coroutine/
1 parent 868e513 commit d9259fd

13 files changed

+20
-20
lines changed

clippy_lints/src/async_yields_async.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl<'tcx> LateLintPass<'tcx> for AsyncYieldsAsync {
4848
use AsyncCoroutineKind::{Block, Closure};
4949
// For functions, with explicitly defined types, don't warn.
5050
// XXXkhuey maybe we should?
51-
if let Some(CoroutineKind::Async(Block | Closure)) = body.generator_kind {
51+
if let Some(CoroutineKind::Async(Block | Closure)) = body.coroutine_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: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,25 +196,25 @@ impl LateLintPass<'_> for AwaitHolding {
196196

197197
fn check_body(&mut self, cx: &LateContext<'_>, body: &'_ Body<'_>) {
198198
use AsyncCoroutineKind::{Block, Closure, Fn};
199-
if let Some(CoroutineKind::Async(Block | Closure | Fn)) = body.generator_kind {
199+
if let Some(CoroutineKind::Async(Block | Closure | Fn)) = body.coroutine_kind {
200200
let def_id = cx.tcx.hir().body_owner_def_id(body.id());
201-
if let Some(generator_layout) = cx.tcx.mir_generator_witnesses(def_id) {
202-
self.check_interior_types(cx, generator_layout);
201+
if let Some(coroutine_layout) = cx.tcx.mir_coroutine_witnesses(def_id) {
202+
self.check_interior_types(cx, coroutine_layout);
203203
}
204204
}
205205
}
206206
}
207207

208208
impl AwaitHolding {
209-
fn check_interior_types(&self, cx: &LateContext<'_>, generator: &CoroutineLayout<'_>) {
210-
for (ty_index, ty_cause) in generator.field_tys.iter_enumerated() {
209+
fn check_interior_types(&self, cx: &LateContext<'_>, coroutine: &CoroutineLayout<'_>) {
210+
for (ty_index, ty_cause) in coroutine.field_tys.iter_enumerated() {
211211
if let rustc_middle::ty::Adt(adt, _) = ty_cause.ty.kind() {
212212
let await_points = || {
213-
generator
213+
coroutine
214214
.variant_source_info
215215
.iter_enumerated()
216216
.filter_map(|(variant, source_info)| {
217-
generator.variant_fields[variant]
217+
coroutine.variant_fields[variant]
218218
.raw
219219
.contains(&ty_index)
220220
.then_some(source_info.span)

clippy_lints/src/doc.rs

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

clippy_lints/src/manual_async_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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(CoroutineKind::Async(AsyncCoroutineKind::Block));
191+
if closure_body.coroutine_kind == Some(CoroutineKind::Async(AsyncCoroutineKind::Block));
192192
then {
193193
return Some(closure_body);
194194
}

clippy_lints/src/methods/iter_kv_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub(super) fn check<'tcx>(
2626
if_chain! {
2727
if !expr.span.from_expansion();
2828
if let ExprKind::Closure(c) = m_arg.kind;
29-
if let Body {params: [p], value: body_expr, generator_kind: _ } = cx.tcx.hir().body(c.body);
29+
if let Body {params: [p], value: body_expr, coroutine_kind: _ } = cx.tcx.hir().body(c.body);
3030
if let PatKind::Tuple([key_pat, val_pat], _) = p.pat.kind;
3131

3232
let (replacement_kind, annotation, bound_ident) = match (&key_pat.kind, &val_pat.kind) {

clippy_lints/src/needless_question_mark.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl LateLintPass<'_> for NeedlessQuestionMark {
8787
}
8888

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

clippy_lints/src/redundant_async_block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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(CoroutineKind::Async(AsyncCoroutineKind::Block)))
74+
matches!(body.coroutine_kind, Some(CoroutineKind::Async(AsyncCoroutineKind::Block)))
7575
{
7676
cx
7777
.typeck_results()

clippy_lints/src/redundant_closure_call.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClosureCall {
144144
// without this check, we'd end up linting twice.
145145
&& !matches!(recv.kind, hir::ExprKind::Call(..))
146146
&& let (full_expr, call_depth) = get_parent_call_exprs(cx, expr)
147-
&& let Some((body, fn_decl, generator_kind)) = find_innermost_closure(cx, recv, call_depth)
147+
&& let Some((body, fn_decl, coroutine_kind)) = find_innermost_closure(cx, recv, call_depth)
148148
{
149149
span_lint_and_then(
150150
cx,
@@ -156,7 +156,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClosureCall {
156156
let mut applicability = Applicability::MachineApplicable;
157157
let mut hint = Sugg::hir_with_context(cx, body, full_expr.span.ctxt(), "..", &mut applicability);
158158

159-
if generator_kind.is_async()
159+
if coroutine_kind.is_async()
160160
&& let hir::ExprKind::Closure(closure) = body.kind
161161
{
162162
let async_closure_body = cx.tcx.hir().body(closure.body);

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::CoroutineKind::Async(_)));
89+
let is_async_block = matches!(b.coroutine_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
@@ -306,7 +306,7 @@ fn check_terminator<'tcx>(
306306
},
307307
TerminatorKind::SwitchInt { discr, targets: _ } => check_operand(tcx, discr, span, body),
308308
TerminatorKind::CoroutineDrop | TerminatorKind::Yield { .. } => {
309-
Err((span, "const fn generators are unstable".into()))
309+
Err((span, "const fn coroutines are unstable".into()))
310310
},
311311
TerminatorKind::Call {
312312
func,

tests/ui/crashes/ice-5238.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Regression test for #5238 / https://github.com/rust-lang/rust/pull/69562
22

3-
#![feature(generators, generator_trait)]
3+
#![feature(coroutines, coroutine_trait)]
44

55
fn main() {
66
let _ = || {

tests/ui/large_futures.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(generators)]
1+
#![feature(coroutines)]
22
#![warn(clippy::large_futures)]
33
#![allow(clippy::never_loop)]
44
#![allow(clippy::future_not_send)]

tests/ui/large_futures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(generators)]
1+
#![feature(coroutines)]
22
#![warn(clippy::large_futures)]
33
#![allow(clippy::never_loop)]
44
#![allow(clippy::future_not_send)]

0 commit comments

Comments
 (0)