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-03 16:30:06 +0200
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2024-05-17 15:28:30 +0000
commit1fcb7198e46212a1689e190aca0e4803d9762e68 (patch)
treeaf28d53adaa272dde57ebd2ca6351a145ac01432 /gcc/rust/backend/rust-compile-resolve-path.cc
parent6f0e06c04f9278057a927f45a72db18602bd0f6e (diff)
downloadgcc-1fcb7198e46212a1689e190aca0e4803d9762e68.zip
gcc-1fcb7198e46212a1689e190aca0e4803d9762e68.tar.gz
gcc-1fcb7198e46212a1689e190aca0e4803d9762e68.tar.bz2
Change lookup_hir_implitem return type
Wrap the return type within an optional. Now return the parent id within a pair instead of taking an out reference. gcc/rust/ChangeLog: * backend/rust-compile-item.cc (CompileItem::visit): Change call site to accept new return type. * backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): Likewise. * backend/rust-mangle-v0.cc (v0_path): Likewise. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise. * checks/lints/rust-lint-marklive.cc (MarkLive::go): Likewise. (MarkLive::visit): Likewise. * typecheck/rust-type-util.cc (query_type): Likewise. * util/rust-hir-map.cc (Mappings::insert_hir_implitem): Likewise. (Mappings::lookup_hir_implitem): 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.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc b/gcc/rust/backend/rust-compile-resolve-path.cc
index a1188e9..58d9e8e 100644
--- a/gcc/rust/backend/rust-compile-resolve-path.cc
+++ b/gcc/rust/backend/rust-compile-resolve-path.cc
@@ -238,18 +238,14 @@ HIRCompileBase::query_compile (HirId ref, TyTy::BaseType *lookup,
}
}
- HirId parent_impl_id = UNKNOWN_HIRID;
- HIR::ImplItem *resolved_item
- = ctx->get_mappings ().lookup_hir_implitem (ref, &parent_impl_id);
- bool is_impl_item = resolved_item != nullptr;
- if (is_impl_item)
+ if (auto resolved_item = ctx->get_mappings ().lookup_hir_implitem (ref))
{
if (!lookup->has_substitutions_defined ())
- return CompileInherentImplItem::Compile (resolved_item, ctx,
+ return CompileInherentImplItem::Compile (resolved_item->first, ctx,
nullptr, true, expr_locus);
else
- return CompileInherentImplItem::Compile (resolved_item, ctx, lookup,
- true, expr_locus);
+ return CompileInherentImplItem::Compile (resolved_item->first, ctx,
+ lookup, true, expr_locus);
}
else
{