aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/parse/rust-parse-impl.h
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2022-10-26 11:25:42 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2022-10-26 11:25:42 +0200
commitdb4b399c25fd3c37e52c6b8dbdf6bc9c0f1deb6c (patch)
treefcca24884621f0aa199b45c12782aa2e826c9295 /gcc/rust/parse/rust-parse-impl.h
parent0cf743d57fc67d88ecba654be8574ea9a5be40d2 (diff)
downloadgcc-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.h5
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).