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
committerArthur Cohen <arthur.cohen@embecosm.com>2025-03-17 16:35:24 +0100
commit16bf7555b6f4ab0d588ec26b7b1a9001ae59928f (patch)
treed2e3729bb71e62a831c7aa4061592b06169226e7 /gcc/rust/backend/rust-compile-resolve-path.cc
parent6dce8a479a288a64ffa87f3e3549f1dc6900b527 (diff)
downloadgcc-16bf7555b6f4ab0d588ec26b7b1a9001ae59928f.zip
gcc-16bf7555b6f4ab0d588ec26b7b1a9001ae59928f.tar.gz
gcc-16bf7555b6f4ab0d588ec26b7b1a9001ae59928f.tar.bz2
gccrs: 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 bf294e4..c27074f 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);