public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] libproc_macro: Change string format
@ 2023-04-06 21:33 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-04-06 21:33 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:36ead3c1b56838f091f4b223dcfc68ff91e66b8d
commit 36ead3c1b56838f091f4b223dcfc68ff91e66b8d
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date: Fri Feb 24 11:16:13 2023 +0100
libproc_macro: Change string format
Change string format to match older rust version. Inline variable name
were not available with rust 1.49.
ChangeLog:
* librust/proc_macro/rust/bridge/literal.rs: Change inline
variable name format to usual empty "{}" along with arguments.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diff:
---
librust/proc_macro/rust/bridge/literal.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/librust/proc_macro/rust/bridge/literal.rs b/librust/proc_macro/rust/bridge/literal.rs
index c2017ac4d94..080cc1b21d8 100644
--- a/librust/proc_macro/rust/bridge/literal.rs
+++ b/librust/proc_macro/rust/bridge/literal.rs
@@ -255,7 +255,7 @@ impl fmt::Display for Literal {
if byte != b'"' && (b' '..=b'z').contains(&byte) {
char::try_from(byte).unwrap().fmt(f)?;
} else {
- write!(f, "\\x{byte:02x}")?;
+ write!(f, "\\x{:02x}", byte)?;
}
}
f.write_str("b\"")?;
@@ -266,8 +266,8 @@ impl fmt::Display for Literal {
'\'' => f.write_str("'\\''")?,
'\0' => f.write_str("'\\0'")?,
'\n' => f.write_str("'\\n'")?,
- ' '..='z' => write!(f, "'{ch}'")?,
- _ => write!(f, "'\\u{val:x}'")?,
+ ' '..='z' => write!(f, "'{}'", ch)?,
+ _ => write!(f, "'\\u{:x}'", val)?,
}
}
Literal::Unsigned(val, suffixed) => match val {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-06 21:33 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:33 [gcc/devel/rust/master] libproc_macro: Change string format 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).