diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-04-12 18:07:08 +0200 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2023-04-21 13:15:47 +0000 |
commit | bfc2f58e1ed3505cff9e4b18343afb985972afcf (patch) | |
tree | 4675d32e25da622fc77581c3feb954dc9ae8e367 | |
parent | dc89a98af04d11796c679b9927aaf8bb62c0cb75 (diff) | |
download | gcc-bfc2f58e1ed3505cff9e4b18343afb985972afcf.tar.gz |
libproc_macro: Implement Drop for TokenStream
TokenStream did not have any drop implementation, the memory could not
have been freed correctly.
ChangeLog:
* libgrust/libproc_macro/rust/bridge/token_stream.rs: Implement
drop.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
-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 56f6679a822..79f161fce44 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) } + } +} |