]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Change return type of lookup_hir_trait_item
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Thu, 25 Apr 2024 12:54:23 +0000 (14:54 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 17 Mar 2025 15:35:23 +0000 (16:35 +0100)
commit7b90f5e5212b056dfac763b6a4e79b533dbe4f2b
tree267765ba0255c7a051b0ea27516b0d7d09f8dc83
parent2d9d7036f3bc831f34972cf243f8012d45da0ff0
gccrs: Change return type of lookup_hir_trait_item

Change the return type to an optional instead of returning a null
pointer. This allows easier tracking of rogue null pointers in the
map. This commit also fixes a bug in trait associated function mangling,
the function was using an already invalidated pointer.

gcc/rust/ChangeLog:

* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile):
Adapt return type to new optional.
* backend/rust-mangle-v0.cc (v0_function_path): Change prototype to use
the generic arguments vector instead of the whole HIR function.
(v0_path): Fix a bug with a null pointer being used to create the
trait function mangling.
* util/rust-hir-map.cc (Mappings::insert_hir_trait_item): Adapt code
to new return type.
(Mappings::lookup_hir_trait_item): Change the return type of the
function to an optional.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/backend/rust-compile-resolve-path.cc
gcc/rust/backend/rust-mangle-v0.cc
gcc/rust/util/rust-hir-map.cc
gcc/rust/util/rust-hir-map.h