Rollup merge of #111491 - compiler-errors:nested-fut-must-use, r=wesleywiser
Dont check `must_use` on nested `impl Future` from fn Fixes (but does not close, per beta policy) #111484 Also fixes a `FIXME` left in the code about (presumably) false-positives on non-async `#[must_use] fn() -> impl Future` cases, though if that's not desirable to include in the beta backport then I can certainly revert it. Beta nominating as it fixes a beta ICE.
This commit is contained in:
commit
2294d81fb3
5 changed files with 32 additions and 14 deletions
|
@ -103,8 +103,10 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
|
|||
&& let ty = cx.typeck_results().expr_ty(&await_expr)
|
||||
&& let ty::Alias(ty::Opaque, ty::AliasTy { def_id: future_def_id, .. }) = ty.kind()
|
||||
&& cx.tcx.ty_is_opaque_future(ty)
|
||||
// FIXME: This also includes non-async fns that return `impl Future`.
|
||||
&& let async_fn_def_id = cx.tcx.parent(*future_def_id)
|
||||
&& matches!(cx.tcx.def_kind(async_fn_def_id), DefKind::Fn | DefKind::AssocFn)
|
||||
// Check that this `impl Future` actually comes from an `async fn`
|
||||
&& cx.tcx.asyncness(async_fn_def_id).is_async()
|
||||
&& check_must_use_def(
|
||||
cx,
|
||||
async_fn_def_id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue