diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-10-26 11:25:42 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-10-26 11:25:42 +0200 |
commit | db4b399c25fd3c37e52c6b8dbdf6bc9c0f1deb6c (patch) | |
tree | fcca24884621f0aa199b45c12782aa2e826c9295 /gcc/rust/parse/rust-parse-impl.h | |
parent | 0cf743d57fc67d88ecba654be8574ea9a5be40d2 (diff) | |
download | gcc-db4b399c25fd3c37e52c6b8dbdf6bc9c0f1deb6c.zip gcc-db4b399c25fd3c37e52c6b8dbdf6bc9c0f1deb6c.tar.gz gcc-db4b399c25fd3c37e52c6b8dbdf6bc9c0f1deb6c.tar.bz2 |
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.
Diffstat (limited to 'gcc/rust/parse/rust-parse-impl.h')
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 5 |
1 files changed, 3 insertions, 2 deletions
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<ManagedTokenSource>::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). |