aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/resolve')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-item.cc6
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-path.cc3
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-type.cc3
3 files changed, 10 insertions, 2 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-item.cc b/gcc/rust/resolve/rust-ast-resolve-item.cc
index 244bf64..75bd2e1 100644
--- a/gcc/rust/resolve/rust-ast-resolve-item.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-item.cc
@@ -1027,6 +1027,12 @@ void
ResolveExternItem::visit (AST::ExternalFunctionItem &function)
{
NodeId scope_node_id = function.get_node_id ();
+ auto decl = CanonicalPath::new_seg (function.get_node_id (),
+ function.get_identifier ());
+ auto path = prefix.append (decl);
+ auto cpath = canonical_prefix.append (decl);
+
+ mappings->insert_canonical_path (function.get_node_id (), cpath);
resolve_visibility (function.get_visibility ());
diff --git a/gcc/rust/resolve/rust-ast-resolve-path.cc b/gcc/rust/resolve/rust-ast-resolve-path.cc
index a03bfb4..27f32aa 100644
--- a/gcc/rust/resolve/rust-ast-resolve-path.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-path.cc
@@ -199,7 +199,8 @@ ResolvePath::resolve_path (AST::PathInExpression *expr)
bool did_resolve_segment = resolved_node_id != UNKNOWN_NODEID;
if (did_resolve_segment)
{
- if (mappings->node_is_module (resolved_node_id))
+ if (mappings->node_is_module (resolved_node_id)
+ || mappings->node_is_crate (resolved_node_id))
{
module_scope_id = resolved_node_id;
}
diff --git a/gcc/rust/resolve/rust-ast-resolve-type.cc b/gcc/rust/resolve/rust-ast-resolve-type.cc
index 8e85889..04183a4 100644
--- a/gcc/rust/resolve/rust-ast-resolve-type.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-type.cc
@@ -220,7 +220,8 @@ ResolveRelativeTypePath::go (AST::TypePath &path, NodeId &resolved_node_id)
bool did_resolve_segment = resolved_node_id != UNKNOWN_NODEID;
if (did_resolve_segment)
{
- if (mappings->node_is_module (resolved_node_id))
+ if (mappings->node_is_module (resolved_node_id)
+ || mappings->node_is_crate (resolved_node_id))
{
module_scope_id = resolved_node_id;
}