]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: marklive: Allow looking up variables in types NS as well
authorArthur Cohen <arthur.cohen@embecosm.com>
Wed, 22 Apr 2026 07:47:43 +0000 (09:47 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Thu, 25 Jun 2026 17:21:27 +0000 (19:21 +0200)
gcc/rust/ChangeLog:

* checks/lints/rust-lint-marklive.cc (MarkLive::find_value_definition): Use Types NS
alongside Values NS for lookup.

gcc/rust/checks/lints/rust-lint-marklive.cc

index 1ef35f328cbd2350f2f1f67128796e6eca1c405b..3998cb70f08fff5b865f145bdb69e9320b5b1bba 100644 (file)
@@ -269,9 +269,11 @@ MarkLive::mark_hir_id (HirId id)
 void
 MarkLive::find_value_definition (NodeId ast_node_id, NodeId &ref_node_id)
 {
-  auto resolved = resolver.lookup (ast_node_id, Resolver2_0::Namespace::Values);
+  auto resolved = resolver.lookup (ast_node_id, Resolver2_0::Namespace::Values,
+                                  Resolver2_0::Namespace::Types);
   rust_assert (resolved.has_value ());
-  ref_node_id = resolved.value ();
+
+  ref_node_id = resolved->id;
 }
 
 } // namespace Analysis