From db4b399c25fd3c37e52c6b8dbdf6bc9c0f1deb6c Mon Sep 17 00:00:00 2001 From: Arthur Cohen Date: Wed, 26 Oct 2022 11:25:42 +0200 Subject: parser: Fix ICE in closure parsing `pattern` is a `unique_ptr`, which should be set to NULL once `std::move`d, hence causing the ICE as we were dereferencing a NULL pointer to get its location. --- gcc/rust/parse/rust-parse-impl.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gcc/rust/parse/rust-parse-impl.h') diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 4ebdcf0..54f3c5c 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -8903,8 +8903,9 @@ Parser::parse_closure_param () } } - return AST::ClosureParam (std::move (pattern), pattern->get_locus (), - std::move (type), std::move (outer_attrs)); + auto locus = pattern->get_locus (); + return AST::ClosureParam (std::move (pattern), locus, std::move (type), + std::move (outer_attrs)); } // Parses a grouped or tuple expression (disambiguates). -- cgit v1.1