aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-02-20 16:12:52 +0100
committerPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-03-30 13:52:31 +0200
commit30fc7d9cf5c03a0ea61749fb84f619cad00ad8c1 (patch)
tree5f65069d1b16e7c28aeed877dea05286b62d8db3
parentae2da395d37469e3120acd7e7db4244fb403ad05 (diff)
downloadgcc-30fc7d9cf5c03a0ea61749fb84f619cad00ad8c1.zip
gcc-30fc7d9cf5c03a0ea61749fb84f619cad00ad8c1.tar.gz
gcc-30fc7d9cf5c03a0ea61749fb84f619cad00ad8c1.tar.bz2
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>
-rw-r--r--librust/proc_macro/rust/bridge/literal.rs6
-rw-r--r--librust/proc_macro/rust/literal.rs4
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 6f7bb51..a0c7aef 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 4011201..02e78c6 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)
}
}