https://gcc.gnu.org/g:ddc90475b353f5be25fe3105f58d12c40d083e73
commit r16-4800-gddc90475b353f5be25fe3105f58d12c40d083e73 Author: Pierre-Emmanuel Patry <[email protected]> Date: Mon Aug 18 10:47:56 2025 +0200 gccrs: Add null check to reconstruct gcc/rust/ChangeLog: * ast/rust-type.h: Prevent reconstruction on null pointers. Signed-off-by: Pierre-Emmanuel Patry <[email protected]> Diff: --- gcc/rust/ast/rust-type.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-type.h b/gcc/rust/ast/rust-type.h index f2502d74501f..8d6c3e5166fc 100644 --- a/gcc/rust/ast/rust-type.h +++ b/gcc/rust/ast/rust-type.h @@ -1048,10 +1048,14 @@ public: BareFunctionType *reconstruct_impl () const override { + std::unique_ptr<TypeNoBounds> ret_type = nullptr; + if (return_type != nullptr) + ret_type = return_type->reconstruct (); + return new BareFunctionType ( for_lifetimes, function_qualifiers, params, /* FIXME: Should params be reconstruct() as well? */ - _is_variadic, variadic_attrs, return_type->reconstruct (), locus); + _is_variadic, variadic_attrs, std::move (ret_type), locus); } protected:
