Use typeck_body

This commit is contained in:
Cameron Steffen 2021-03-05 10:35:39 -06:00
parent ae8ec07d2e
commit 5abd8c5995
2 changed files with 2 additions and 4 deletions

View file

@ -50,8 +50,7 @@ impl<'tcx> LateLintPass<'tcx> for AsyncYieldsAsync {
let body_id = BodyId { let body_id = BodyId {
hir_id: body.value.hir_id, hir_id: body.value.hir_id,
}; };
let def_id = cx.tcx.hir().body_owner_def_id(body_id); let typeck_results = cx.tcx.typeck_body(body_id);
let typeck_results = cx.tcx.typeck(def_id);
let expr_ty = typeck_results.expr_ty(&body.value); let expr_ty = typeck_results.expr_ty(&body.value);
if implements_trait(cx, expr_ty, future_trait_def_id, &[]) { if implements_trait(cx, expr_ty, future_trait_def_id, &[]) {

View file

@ -97,8 +97,7 @@ impl LateLintPass<'_> for AwaitHolding {
let body_id = BodyId { let body_id = BodyId {
hir_id: body.value.hir_id, hir_id: body.value.hir_id,
}; };
let def_id = cx.tcx.hir().body_owner_def_id(body_id); let typeck_results = cx.tcx.typeck_body(body_id);
let typeck_results = cx.tcx.typeck(def_id);
check_interior_types( check_interior_types(
cx, cx,
&typeck_results.generator_interior_types.as_ref().skip_binder(), &typeck_results.generator_interior_types.as_ref().skip_binder(),