aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-fmt.cc
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2024-02-13 16:31:25 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2024-08-01 13:11:29 +0200
commit0f9668507c9843a773af794ed8d0b0de3fa8b5cf (patch)
tree9baf7f99f190a6ead727f097aa2b7e204341b3dd /gcc/rust/ast/rust-fmt.cc
parent827231aac4d0532dd74863f72c11462cecd02abb (diff)
downloadgcc-0f9668507c9843a773af794ed8d0b0de3fa8b5cf.zip
gcc-0f9668507c9843a773af794ed8d0b0de3fa8b5cf.tar.gz
gcc-0f9668507c9843a773af794ed8d0b0de3fa8b5cf.tar.bz2
gccrs: rust-fmt: Store parsed string in Pieces struct
gcc/rust/ChangeLog: * ast/rust-fmt.cc (Pieces::collect): Fix signature to take ownership of the given string. * ast/rust-fmt.h (struct Pieces): Store parsed string in the struct. libgrust/ChangeLog: * libformat_parser/src/lib.rs: Add debug prompt.
Diffstat (limited to 'gcc/rust/ast/rust-fmt.cc')
-rw-r--r--gcc/rust/ast/rust-fmt.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/rust/ast/rust-fmt.cc b/gcc/rust/ast/rust-fmt.cc
index f6ee8a2..511e947 100644
--- a/gcc/rust/ast/rust-fmt.cc
+++ b/gcc/rust/ast/rust-fmt.cc
@@ -23,7 +23,7 @@ namespace Rust {
namespace Fmt {
Pieces
-Pieces::collect (const std::string &to_parse)
+Pieces::collect (std::string &&to_parse)
{
auto piece_slice = collect_pieces (to_parse.c_str ());
@@ -34,7 +34,7 @@ Pieces::collect (const std::string &to_parse)
// auto pieces = std::vector<Piece> (piece_slice.base_ptr,
// piece_slice.base_ptr + piece_slice.len);
- return Pieces (piece_slice);
+ return Pieces (piece_slice, std::move (to_parse));
}
Pieces::~Pieces () { destroy_pieces (slice); }