aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-resolve-path.cc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2024-05-02 13:44:10 +0200
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2024-05-17 15:28:30 +0000
commitfa24d0d08eb385df313beab7dd7c8a1091c216c4 (patch)
tree012f21a6eadcc1dd5f97f85382c98801de0f763f /gcc/rust/backend/rust-compile-resolve-path.cc
parent310081b7d629e4640d0b962f727ac4249bd51e25 (diff)
downloadgcc-fa24d0d08eb385df313beab7dd7c8a1091c216c4.zip
gcc-fa24d0d08eb385df313beab7dd7c8a1091c216c4.tar.gz
gcc-fa24d0d08eb385df313beab7dd7c8a1091c216c4.tar.bz2
Change lookup_hir_extern_item return type
Wrap the return type with an optional and make the return type a pair with the parent hid. gcc/rust/ChangeLog: * backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): Adapt code around new return type. * checks/errors/rust-const-checker.cc (ConstChecker::check_function_call): Likewise. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::check_use_of_static): Likewise. (UnsafeChecker::check_function_call): Likewise. * typecheck/rust-type-util.cc (query_type): Likewise. * util/rust-hir-map.cc (Mappings::insert_hir_extern_item): Likewise. (Mappings::lookup_hir_extern_item): Change return type. * util/rust-hir-map.h: Update the function's prototype. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-resolve-path.cc')
-rw-r--r--gcc/rust/backend/rust-compile-resolve-path.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc b/gcc/rust/backend/rust-compile-resolve-path.cc
index 6ca4d62..a1188e9 100644
--- a/gcc/rust/backend/rust-compile-resolve-path.cc
+++ b/gcc/rust/backend/rust-compile-resolve-path.cc
@@ -201,10 +201,6 @@ HIRCompileBase::query_compile (HirId ref, TyTy::BaseType *lookup,
const Analysis::NodeMapping &mappings,
location_t expr_locus, bool is_qualified_path)
{
- HirId parent_block;
- HIR::ExternalItem *resolved_extern_item
- = ctx->get_mappings ().lookup_hir_extern_item (ref, &parent_block);
- bool is_hir_extern_item = resolved_extern_item != nullptr;
bool is_fn = lookup->get_kind () == TyTy::TypeKind::FNDEF;
if (auto resolved_item = ctx->get_mappings ().lookup_hir_item (ref))
{
@@ -215,8 +211,10 @@ HIRCompileBase::query_compile (HirId ref, TyTy::BaseType *lookup,
return CompileItem::compile (*resolved_item, ctx, lookup, true,
expr_locus);
}
- else if (is_hir_extern_item)
+ else if (auto hir_extern_item
+ = ctx->get_mappings ().lookup_hir_extern_item (ref))
{
+ HIR::ExternalItem *resolved_extern_item = hir_extern_item->first;
if (!lookup->has_substitutions_defined ())
return CompileExternItem::compile (resolved_extern_item, ctx, nullptr,
true, expr_locus);