public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] libproc_macro: Implement Display for Group
@ 2023-04-06 21:32 Thomas Schwinge
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Schwinge @ 2023-04-06 21:32 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:8901323c390b71b41ba11d1bcb9f166f2e15226c
commit 8901323c390b71b41ba11d1bcb9f166f2e15226c
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date: Mon Feb 20 16:34:43 2023 +0100
libproc_macro: Implement Display for Group
Implement the Display trait for the rust Group external structure.
ChangeLog:
* librust/proc_macro/rust/group.rs: Implement Display.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diff:
---
librust/proc_macro/rust/group.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/librust/proc_macro/rust/group.rs b/librust/proc_macro/rust/group.rs
index 6512982cc32..5b4bd6c710e 100644
--- a/librust/proc_macro/rust/group.rs
+++ b/librust/proc_macro/rust/group.rs
@@ -76,8 +76,8 @@ impl Group {
}
impl fmt::Display for Group {
- 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] 2+ messages in thread
* [gcc/devel/rust/master] libproc_macro: Implement Display for Group
@ 2023-04-06 21:31 Thomas Schwinge
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Schwinge @ 2023-04-06 21:31 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:fa88446bd539415fcb8301ba25048f8499422c88
commit fa88446bd539415fcb8301ba25048f8499422c88
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date: Mon Feb 20 15:48:13 2023 +0100
libproc_macro: Implement Display for Group
Implement the Display trait on internal rust Group structure.
ChangeLog:
* librust/proc_macro/rust/bridge/group.rs: Implement Display.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diff:
---
librust/proc_macro/rust/bridge/group.rs | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/librust/proc_macro/rust/bridge/group.rs b/librust/proc_macro/rust/bridge/group.rs
index 6590f8952fa..5a68d87d972 100644
--- a/librust/proc_macro/rust/bridge/group.rs
+++ b/librust/proc_macro/rust/bridge/group.rs
@@ -1,4 +1,5 @@
use bridge;
+use std::fmt;
use Delimiter;
#[repr(C)]
@@ -7,3 +8,24 @@ pub struct Group {
delimiter: Delimiter,
stream: bridge::token_stream::TokenStream,
}
+impl fmt::Display for Group {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self.delimiter {
+ Delimiter::Parenthesis => f.write_str("(")?,
+ Delimiter::Brace => f.write_str("{")?,
+ Delimiter::Bracket => f.write_str("[")?,
+ Delimiter::None => (),
+ }
+
+ self.stream.fmt(f)?;
+
+ match self.delimiter {
+ Delimiter::Parenthesis => f.write_str(")")?,
+ Delimiter::Brace => f.write_str("}")?,
+ Delimiter::Bracket => f.write_str("]")?,
+ Delimiter::None => (),
+ }
+
+ Ok(())
+ }
+}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-06 21:32 UTC | newest]
Thread overview: 2+ messages (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 Display for Group Thomas Schwinge
-- strict thread matches above, loose matches on Subject: below --
2023-04-06 21:31 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).