about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-04-04 10:48:47 -0400
committerMichael Goulet <michael@errs.io>2024-04-15 16:45:01 -0400
commit41cf87b71b792b40155cd79f96234a89ae7dc27f (patch)
tree6ee0e6730abc011d45a0c972a7b1b79c3256489f /compiler/rustc_hir_analysis/src
parentc897092654bae65d5695ef3b1a5850c15513ed5d (diff)
downloadrust-41cf87b71b792b40155cd79f96234a89ae7dc27f.tar.gz
rust-41cf87b71b792b40155cd79f96234a89ae7dc27f.zip
Lower and resolve precise captures in HIR
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
-rw-r--r--compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
index 3d16f1420d9..8e29269e8fd 100644
--- a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
+++ b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
@@ -557,6 +557,31 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
         }
     }
 
+    fn visit_precise_capturing_arg(
+        &mut self,
+        arg: &'tcx hir::PreciseCapturingArg<'tcx>,
+    ) -> Self::Result {
+        match *arg {
+            hir::PreciseCapturingArg::Lifetime(lt) => match lt.res {
+                LifetimeName::Param(def_id) => {
+                    self.resolve_lifetime_ref(def_id, lt);
+                }
+                LifetimeName::Error => {}
+                LifetimeName::ImplicitObjectLifetimeDefault
+                | LifetimeName::Infer
+                | LifetimeName::Static => todo!("TODO: Error on invalid lifetime"),
+            },
+            hir::PreciseCapturingArg::Param(res, hir_id) => match res {
+                Res::Def(DefKind::TyParam | DefKind::ConstParam, def_id)
+                | Res::SelfTyParam { trait_: def_id } => {
+                    self.resolve_type_ref(def_id.expect_local(), hir_id);
+                }
+                Res::Err => {}
+                _ => todo!("TODO: Error on invalid param res"),
+            },
+        }
+    }
+
     fn visit_foreign_item(&mut self, item: &'tcx hir::ForeignItem<'tcx>) {
         match item.kind {
             hir::ForeignItemKind::Fn(_, _, generics) => {