Add hir::Node::PreciseCapturingNonLifetimeArg

This commit is contained in:
Michael Goulet 2024-04-04 14:46:26 -04:00
parent 42ba57c013
commit 02d7317af2
14 changed files with 110 additions and 38 deletions

View file

@ -487,7 +487,9 @@ fn check_opaque_precise_captures<'tcx>(tcx: TyCtxt<'tcx>, opaque_def_id: LocalDe
for arg in precise_capturing_args {
match *arg {
hir::PreciseCapturingArg::Lifetime(&hir::Lifetime { hir_id, .. })
| hir::PreciseCapturingArg::Param(_, hir_id) => match tcx.named_bound_var(hir_id) {
| hir::PreciseCapturingArg::Param(hir::PreciseCapturingNonLifetimeArg {
hir_id, ..
}) => match tcx.named_bound_var(hir_id) {
Some(ResolvedArg::EarlyBound(def_id)) => {
expected_captures.insert(def_id);
}

View file

@ -577,10 +577,10 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
});
}
},
hir::PreciseCapturingArg::Param(res, hir_id) => match res {
hir::PreciseCapturingArg::Param(param) => match param.res {
Res::Def(DefKind::TyParam | DefKind::ConstParam, def_id)
| Res::SelfTyParam { trait_: def_id } => {
self.resolve_type_ref(def_id.expect_local(), hir_id);
self.resolve_type_ref(def_id.expect_local(), param.hir_id);
}
Res::Err => {}
_ => {