Skip to content

Commit ad7db09

Browse files
committed
Auto merge of rust-lang#3132 - rust-lang:rustup-2023-10-21, r=RalfJung
Automatic Rustup
2 parents cb9685a + 87634c8 commit ad7db09

15 files changed

+33
-33
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.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: 10 additions & 10 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,26 +195,26 @@ 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.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: &GeneratorLayout<'_>) {
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/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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,8 @@ 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();
440-
if is_type_diagnostic_item(cx, subs.as_generator().return_ty(), sym::Result);
439+
if let ty::Coroutine(_, subs, _) = ret_ty.kind();
440+
if is_type_diagnostic_item(cx, subs.as_coroutine().return_ty(), sym::Result);
441441
then {
442442
span_lint(
443443
cx,

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.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: 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.coroutine_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.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);

0 commit comments

Comments
 (0)