Skip to content

Commit 7895b98

Browse files
committedFeb 6, 2024
Add CoroutineClosure to TyKind, AggregateKind, UpvarArgs
1 parent d13ce19 commit 7895b98

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed
 

‎clippy_lints/src/dereference.rs

+1
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,7 @@ impl TyCoercionStability {
881881
| ty::Coroutine(..)
882882
| ty::CoroutineWitness(..)
883883
| ty::Closure(..)
884+
| ty::CoroutineClosure(..)
884885
| ty::Never
885886
| ty::Tuple(_)
886887
| ty::Alias(ty::Projection, _) => Self::Deref,

‎clippy_lints/src/utils/author.rs

+3
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,9 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
490490
format!("ClosureKind::Coroutine(CoroutineKind::Coroutine(Movability::{movability:?})")
491491
},
492492
},
493+
ClosureKind::CoroutineClosure(desugaring) => format!(
494+
"ClosureKind::CoroutineClosure(CoroutineDesugaring::{desugaring:?})"
495+
),
493496
};
494497

495498
let ret_ty = match fn_decl.output {

‎tests/ui/author/blocks.stdout

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ if let ExprKind::Block(block, None) = expr.kind
4040
{
4141
// report your lint here
4242
}
43-
if let ExprKind::Closure { capture_clause: CaptureBy::Value { .. }, fn_decl: fn_decl, body: body_id, closure_kind: ClosureKind::Closure, .. } = expr.kind
43+
if let ExprKind::Closure { capture_clause: CaptureBy::Value { .. }, fn_decl: fn_decl, body: body_id, closure_kind: ClosureKind::CoroutineClosure(CoroutineDesugaring::Async), .. } = expr.kind
4444
&& let FnRetTy::DefaultReturn(_) = fn_decl.output
4545
&& expr1 = &cx.tcx.hir().body(body_id).value
46-
&& let ExprKind::Closure { capture_clause: CaptureBy::Value { .. }, fn_decl: fn_decl1, body: body_id1, closure_kind: ClosureKind::Coroutine(CoroutineKind::Desugared(CoroutineDesugaring::Async, CoroutineSource::Closure)), .. } = expr1.kind
46+
&& let ExprKind::Closure { capture_clause: CaptureBy::Ref, fn_decl: fn_decl1, body: body_id1, closure_kind: ClosureKind::Coroutine(CoroutineKind::Desugared(CoroutineDesugaring::Async, CoroutineSource::Closure)), .. } = expr1.kind
4747
&& let FnRetTy::DefaultReturn(_) = fn_decl1.output
4848
&& expr2 = &cx.tcx.hir().body(body_id1).value
4949
&& let ExprKind::Block(block, None) = expr2.kind

0 commit comments

Comments
 (0)