diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-04-12 18:07:08 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:34:12 +0100 |
commit | 98b779a83cbbbe87e2aad76d230b6c8674645943 (patch) | |
tree | cbdb9f25be33cc5f958e2cdb3093cd47b6d27256 /libgrust | |
parent | b44757f8360c44bb83e45bf7a0d5dc10ce4f4916 (diff) | |
download | gcc-98b779a83cbbbe87e2aad76d230b6c8674645943.zip gcc-98b779a83cbbbe87e2aad76d230b6c8674645943.tar.gz gcc-98b779a83cbbbe87e2aad76d230b6c8674645943.tar.bz2 |
gccrs: libproc_macro: Implement Drop for TokenStream
TokenStream did not have any drop implementation, the memory could not
have been freed correctly.
libgrust/ChangeLog:
* libproc_macro/rust/bridge/token_stream.rs: Implement
drop.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'libgrust')
-rw-r--r-- | libgrust/libproc_macro/rust/bridge/token_stream.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libgrust/libproc_macro/rust/bridge/token_stream.rs b/libgrust/libproc_macro/rust/bridge/token_stream.rs index 56f6679..79f161f 100644 --- a/libgrust/libproc_macro/rust/bridge/token_stream.rs +++ b/libgrust/libproc_macro/rust/bridge/token_stream.rs @@ -15,6 +15,7 @@ extern "C" { fn TokenStream__push(stream: *mut TokenStream, tree: TokenTree); fn TokenStream__from_string(str: *const c_uchar, len: u64, ts: *mut TokenStream) -> bool; fn TokenStream__clone(ts: *const TokenStream) -> TokenStream; + fn TokenStream__drop(stream: *mut TokenStream); } #[repr(C)] @@ -154,3 +155,9 @@ impl Clone for TokenStream { unsafe { TokenStream__clone(self as *const TokenStream) } } } + +impl Drop for TokenStream { + fn drop(&mut self) { + unsafe { TokenStream__drop(self as *mut TokenStream) } + } +} |