public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] libproc_macro: Implement Debug on Literal
@ 2023-04-06 21:32 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-04-06 21:32 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:30fc7d9cf5c03a0ea61749fb84f619cad00ad8c1
commit 30fc7d9cf5c03a0ea61749fb84f619cad00ad8c1
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date: Mon Feb 20 16:12:52 2023 +0100
libproc_macro: Implement Debug on Literal
Implement the Debug trait on Literal external rust structure.
ChangeLog:
* librust/proc_macro/rust/bridge/literal.rs: Derive Debug on
inner types.
* librust/proc_macro/rust/literal.rs: Implement Debug.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diff:
---
librust/proc_macro/rust/bridge/literal.rs | 6 +++---
librust/proc_macro/rust/literal.rs | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/librust/proc_macro/rust/bridge/literal.rs b/librust/proc_macro/rust/bridge/literal.rs
index 6f7bb512378..a0c7aef0e36 100644
--- a/librust/proc_macro/rust/bridge/literal.rs
+++ b/librust/proc_macro/rust/bridge/literal.rs
@@ -10,7 +10,7 @@ extern "C" {
}
#[repr(C)]
-#[derive(Clone)]
+#[derive(Debug, Clone)]
pub enum Unsigned {
Unsigned8(u8),
Unsigned16(u16),
@@ -23,7 +23,7 @@ pub enum Unsigned {
}
#[repr(C)]
-#[derive(Clone)]
+#[derive(Debug, Clone)]
pub enum Signed {
Signed8(i8),
Signed16(i16),
@@ -36,7 +36,7 @@ pub enum Signed {
}
#[repr(C)]
-#[derive(Clone)]
+#[derive(Debug, Clone)]
pub enum Literal {
/// String literal internal representation
///
diff --git a/librust/proc_macro/rust/literal.rs b/librust/proc_macro/rust/literal.rs
index 4011201d998..02e78c61ca8 100644
--- a/librust/proc_macro/rust/literal.rs
+++ b/librust/proc_macro/rust/literal.rs
@@ -169,8 +169,8 @@ impl Literal {
}
impl fmt::Debug for Literal {
- 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:32 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:32 [gcc/devel/rust/master] libproc_macro: Implement Debug on Literal 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).