Rust: Work around 'error[E0599]: no method named `leak` found for struct `std::string::String` in the current scope' (was: [PATCH 048/125] gccrs: format-args: Start storing string in Rust memory)

2024-11-23 Thread Thomas Schwinge
Hi! On 2024-08-01T16:56:44+0200, Arthur Cohen wrote: > --- a/libgrust/libformat_parser/src/lib.rs > +++ b/libgrust/libformat_parser/src/lib.rs > [...] > +let rust_string = RustString { > +len: str.len(), > +cap: str.capacity(), > +ptr: str.leak().as_ptr(), > +}; >

[PATCH 048/125] gccrs: format-args: Start storing string in Rust memory

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * ast/rust-fmt.cc (ffi::RustHamster::to_string): New. (Pieces::collect): Adapt to use new handle API. (Pieces::~Pieces): Likewise. (Pieces::Pieces): Likewise. (Pieces::operator=): Likewise. * ast/rust-fmt.h (struct RustString): Ad