Unit struct have a special constructor that should be added to the struct
namespace in order to be resolved later when called. As it is a function
it should be added in the value namespace.
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Add the struct constructor when the struct is a unit.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
GlobbingVisitor::visit (AST::StructStruct &struct_item)
{
if (struct_item.get_visibility ().is_public ())
- ctx.insert_shadowable (struct_item.get_identifier (),
- struct_item.get_node_id (), Namespace::Values);
+ {
+ ctx.insert_shadowable (struct_item.get_identifier (),
+ struct_item.get_node_id (), Namespace::Types);
+ if (struct_item.is_unit_struct ())
+ ctx.insert_shadowable (struct_item.get_identifier (),
+ struct_item.get_node_id (), Namespace::Values);
+ }
}
void