about summary refs log tree commit diff
path: root/src/libsyntax/parse/mod.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-05-07 22:59:30 +0000
committerbors <bors@rust-lang.org>2017-05-07 22:59:30 +0000
commit9956e81c19c2f5bbc273d75b49f2e031d80d0e4e (patch)
tree310745f2077404dbd30a486775066bf145284b1e /src/libsyntax/parse/mod.rs
parentd985625b3c04c8a9b083da712fbc951b38093a58 (diff)
parent0be875827fe64412f6c0eedc8f775f57137e7c55 (diff)
downloadrust-9956e81c19c2f5bbc273d75b49f2e031d80d0e4e.tar.gz
rust-9956e81c19c2f5bbc273d75b49f2e031d80d0e4e.zip
Auto merge of #41729 - ubsan:master, r=nrc
Delete features which are easily removed, in libsyntax
Diffstat (limited to 'src/libsyntax/parse/mod.rs')
-rw-r--r--src/libsyntax/parse/mod.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 9d8f3b3d039..fe3ca1cf230 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -261,10 +261,14 @@ pub fn char_lit(lit: &str) -> (char, isize) {
     }
 }
 
+pub fn escape_default(s: &str) -> String {
+    s.chars().map(char::escape_default).flat_map(|x| x).collect()
+}
+
 /// Parse a string representing a string literal into its final form. Does
 /// unescaping.
 pub fn str_lit(lit: &str) -> String {
-    debug!("parse_str_lit: given {}", lit.escape_default());
+    debug!("parse_str_lit: given {}", escape_default(lit));
     let mut res = String::with_capacity(lit.len());
 
     // FIXME #8372: This could be a for-loop if it didn't borrow the iterator
@@ -339,7 +343,7 @@ pub fn str_lit(lit: &str) -> String {
 /// Parse a string representing a raw string literal into its final form. The
 /// only operation this does is convert embedded CRLF into a single LF.
 pub fn raw_str_lit(lit: &str) -> String {
-    debug!("raw_str_lit: given {}", lit.escape_default());
+    debug!("raw_str_lit: given {}", escape_default(lit));
     let mut res = String::with_capacity(lit.len());
 
     // FIXME #8372: This could be a for-loop if it didn't borrow the iterator