about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libsyntax/attr.rs5
-rw-r--r--src/libsyntax/lib.rs1
2 files changed, 2 insertions, 4 deletions
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index c68a743303a..05fabbee389 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -1228,10 +1228,7 @@ impl LitKind {
 
         match *self {
             LitKind::Str(string, ast::StrStyle::Cooked) => {
-                let mut escaped = String::new();
-                for ch in string.as_str().chars() {
-                    escaped.extend(ch.escape_unicode());
-                }
+                let escaped = string.as_str().escape_default();
                 Token::Literal(token::Lit::Str_(Symbol::intern(&escaped)), None)
             }
             LitKind::Str(string, ast::StrStyle::Raw(n)) => {
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index 870ce1926ad..f148aaf7267 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -25,6 +25,7 @@
 #![feature(non_exhaustive)]
 #![feature(const_atomic_usize_new)]
 #![feature(rustc_attrs)]
+#![feature(str_escape)]
 
 #![recursion_limit="256"]