aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-02-20 16:07:18 +0100
committerPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-03-30 13:52:31 +0200
commitae2da395d37469e3120acd7e7db4244fb403ad05 (patch)
tree375a5d574d7dc2109f677d230755a7f13408493a
parent3762177c58e4780f16f6eaf8dd237d8e50fa9c94 (diff)
downloadgcc-ae2da395d37469e3120acd7e7db4244fb403ad05.zip
gcc-ae2da395d37469e3120acd7e7db4244fb403ad05.tar.gz
gcc-ae2da395d37469e3120acd7e7db4244fb403ad05.tar.bz2
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>
-rw-r--r--librust/proc_macro/rust/bridge/token_stream.rs2
-rw-r--r--librust/proc_macro/rust/lib.rs4
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 2ddde8e..eca0902 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 aa90a51..59b4929 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)
}
}