public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/rust/master] libproc_macro: Implement Drop for TokenStream
Date: Tue,  2 May 2023 07:09:37 +0000 (GMT)	[thread overview]
Message-ID: <20230502070937.A29C33857344@sourceware.org> (raw)

https://gcc.gnu.org/g:bfc2f58e1ed3505cff9e4b18343afb985972afcf

commit bfc2f58e1ed3505cff9e4b18343afb985972afcf
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Wed Apr 12 18:07:08 2023 +0200

    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>

Diff:
---
 libgrust/libproc_macro/rust/bridge/token_stream.rs | 7 +++++++
 1 file changed, 7 insertions(+)

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) }
+    }
+}

                 reply	other threads:[~2023-05-02  7:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230502070937.A29C33857344@sourceware.org \
    --to=tschwinge@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).