diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2024-04-26 12:02:53 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-17 16:35:24 +0100 |
commit | 1d6389b2916e9e285d16ab1d3cb8b7d6650d7cd6 (patch) | |
tree | c9a44d466633aed5c15c537c1a1f05599e837a27 /gcc/rust/util/rust-hir-map.cc | |
parent | 520a61b1dc7fdc072c825a687749316ed698f926 (diff) | |
download | gcc-1d6389b2916e9e285d16ab1d3cb8b7d6650d7cd6.zip gcc-1d6389b2916e9e285d16ab1d3cb8b7d6650d7cd6.tar.gz gcc-1d6389b2916e9e285d16ab1d3cb8b7d6650d7cd6.tar.bz2 |
gccrs: Change return type of lookup_defid
Change the return type to an optional.
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address):
Change calling code to accomodate new return type.
* checks/errors/privacy/rust-privacy-reporter.cc:
Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate):
Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_builtin_candidate):
Likewise.
* typecheck/rust-tyty.cc (ClosureType::setup_fn_once_output): Likewise.
* util/rust-hir-map.cc (Mappings::lookup_defid): Change function's
return type.
* util/rust-hir-map.h: Update function's prototype.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/util/rust-hir-map.cc')
-rw-r--r-- | gcc/rust/util/rust-hir-map.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc index cb4e95a..899f71b 100644 --- a/gcc/rust/util/rust-hir-map.cc +++ b/gcc/rust/util/rust-hir-map.cc @@ -312,7 +312,7 @@ Mappings::insert_defid_mapping (DefId id, HIR::Item *item) CrateNum crate_num = id.crateNum; LocalDefId local_def_id = id.localDefId; - rust_assert (lookup_defid (id) == nullptr); + rust_assert (!lookup_defid (id)); rust_assert (lookup_local_defid (crate_num, local_def_id) == nullptr); rust_assert (lookup_trait_item_defid (id) == nullptr); @@ -320,12 +320,12 @@ Mappings::insert_defid_mapping (DefId id, HIR::Item *item) insert_local_defid_mapping (crate_num, local_def_id, item); } -HIR::Item * +tl::optional<HIR::Item *> Mappings::lookup_defid (DefId id) { auto it = defIdMappings.find (id); if (it == defIdMappings.end ()) - return nullptr; + return tl::nullopt; return it->second; } @@ -336,7 +336,7 @@ Mappings::insert_defid_mapping (DefId id, HIR::TraitItem *item) CrateNum crate_num = id.crateNum; LocalDefId local_def_id = id.localDefId; - rust_assert (lookup_defid (id) == nullptr); + rust_assert (!lookup_defid (id)); rust_assert (lookup_local_defid (crate_num, local_def_id) == nullptr); rust_assert (lookup_trait_item_defid (id) == nullptr); |