diff --git a/gcc/rust/resolve/rust-late-name-resolver-2.0.cc b/gcc/rust/resolve/rust-late-name-resolver-2.0.cc index 8319a9fe311..143c9cd5f2f 100644 --- a/gcc/rust/resolve/rust-late-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-late-name-resolver-2.0.cc @@ -272,10 +272,19 @@ Late::visit (AST::StructStruct &s) ctx.scoped (Rib::Kind::Item, s.get_node_id (), s_vis); } +void +Late::visit (AST::StructExprStruct &s) +{ + auto resolved = ctx.types.resolve_path (s.get_struct_name ().get_segments ()); + + ctx.map_usage (Usage (s.get_struct_name ().get_node_id ()), + Definition (resolved->get_node_id ())); +} + void Late::visit (AST::StructExprStructBase &s) { - auto resolved = ctx.types.get (s.get_struct_name ().as_string ()); + auto resolved = ctx.types.resolve_path (s.get_struct_name ().get_segments ()); ctx.map_usage (Usage (s.get_struct_name ().get_node_id ()), Definition (resolved->get_node_id ())); @@ -285,7 +294,7 @@ Late::visit (AST::StructExprStructBase &s) void Late::visit (AST::StructExprStructFields &s) { - auto resolved = ctx.types.get (s.get_struct_name ().as_string ()); + auto resolved = ctx.types.resolve_path (s.get_struct_name ().get_segments ()); ctx.map_usage (Usage (s.get_struct_name ().get_node_id ()), Definition (resolved->get_node_id ())); diff --git a/gcc/rust/resolve/rust-late-name-resolver-2.0.h b/gcc/rust/resolve/rust-late-name-resolver-2.0.h index 81c3a046bf4..59077035ce3 100644 --- a/gcc/rust/resolve/rust-late-name-resolver-2.0.h +++ b/gcc/rust/resolve/rust-late-name-resolver-2.0.h @@ -47,6 +47,7 @@ class Late : public DefaultResolver void visit (AST::IdentifierExpr &) override; void visit (AST::PathInExpression &) override; void visit (AST::TypePath &) override; + void visit (AST::StructExprStruct &) override; void visit (AST::StructExprStructBase &) override; void visit (AST::StructExprStructFields &) override; void visit (AST::StructStruct &) override;