public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] libproc_macro: Add Debug impl for TokenStream
@ 2023-04-06 21:31 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-04-06 21:31 UTC (permalink / raw)
  To: gcc-cvs

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

commit ae2da395d37469e3120acd7e7db4244fb403ad05
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Mon Feb 20 16:07:18 2023 +0100

    libproc_macro: Add Debug impl for TokenStream
    
    Add the Debug trait implementation for the TokenStream external rust
    structure.
    
    ChangeLog:
    
            * librust/proc_macro/rust/bridge/token_stream.rs: Add derive.
            * librust/proc_macro/rust/lib.rs: Add TokenStream debug
            implementation.
    
    Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Diff:
---
 librust/proc_macro/rust/bridge/token_stream.rs | 2 +-
 librust/proc_macro/rust/lib.rs                 | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/librust/proc_macro/rust/bridge/token_stream.rs b/librust/proc_macro/rust/bridge/token_stream.rs
index 2ddde8ed0b6..eca0902e330 100644
--- a/librust/proc_macro/rust/bridge/token_stream.rs
+++ b/librust/proc_macro/rust/bridge/token_stream.rs
@@ -48,7 +48,7 @@ extern "C" {
 }
 
 #[repr(C)]
-#[derive(Clone)]
+#[derive(Debug, Clone)]
 pub struct TokenStream {
     pub(crate) data: *const TokenTree,
     pub(crate) size: u64,
diff --git a/librust/proc_macro/rust/lib.rs b/librust/proc_macro/rust/lib.rs
index aa90a51db54..59b49297d1e 100644
--- a/librust/proc_macro/rust/lib.rs
+++ b/librust/proc_macro/rust/lib.rs
@@ -160,8 +160,8 @@ impl fmt::Display for TokenStream {
 }
 
 impl fmt::Debug for TokenStream {
-    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        todo!("Implement this function")
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        self.0.fmt(f)
     }
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-06 21:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-06 21:31 [gcc/devel/rust/master] libproc_macro: Add Debug impl for TokenStream Thomas Schwinge

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).