From bccdba02960b3cd428addbc2c856065ebb81eb04 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Fri, 6 Jun 2014 16:04:04 +0100 Subject: Add a b'x' byte literal of type u8. --- src/libsyntax/print/pprust.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/libsyntax/print') diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index badfbe7eb15..6ea2eed293e 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2305,6 +2305,12 @@ impl<'a> State<'a> { } match lit.node { ast::LitStr(ref st, style) => self.print_string(st.get(), style), + ast::LitByte(byte) => { + let mut res = String::from_str("b'"); + (byte as char).escape_default(|c| res.push_char(c)); + res.push_char('\''); + word(&mut self.s, res.as_slice()) + } ast::LitChar(ch) => { let mut res = String::from_str("'"); ch.escape_default(|c| res.push_char(c)); -- cgit 1.4.1-3-g733a5