about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-02-12 23:30:16 +0000
committerbors <bors@rust-lang.org>2019-02-12 23:30:16 +0000
commit0f949c2fcc696d0260a99196d5e5400c59a26a54 (patch)
tree3983d71e145a23778a0f394871d959360f35d5fb /src/libsyntax
parentb244f61b77c42d7be695afd7901ee4418559e518 (diff)
parenteb158f93505dbc265787ac671cbc728c80f8a39d (diff)
Auto merge of #58051 - SimonSapin:str_escape, r=alexcrichton
Stabilize str::escape_* methods with new return types…

… that implement `Display` and `Iterator<Item=char>`, as proposed in FCP: https://github.com/rust-lang/rust/issues/27791#issuecomment-376864727
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/attr/mod.rs2
-rw-r--r--src/libsyntax/lib.rs1
-rw-r--r--src/libsyntax/print/pprust.rs2
3 files changed, 2 insertions, 3 deletions
diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs
index a4f5449ec54..29e86e0ecee 100644
--- a/src/libsyntax/attr/mod.rs
+++ b/src/libsyntax/attr/mod.rs
@@ -634,7 +634,7 @@ impl LitKind {
 
         match *self {
             LitKind::Str(string, ast::StrStyle::Cooked) => {
-                let escaped = string.as_str().escape_default();
+                let escaped = string.as_str().escape_default().to_string();
                 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 c844f9e2a91..a56cdf623bf 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -15,7 +15,6 @@
 #![feature(rustc_attrs)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(slice_sort_by_cached_key)]
-#![feature(str_escape)]
 #![feature(step_trait)]
 #![feature(try_trait)]
 #![feature(unicode_internals)]
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index c670f47b597..cdf805176a2 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -606,7 +606,7 @@ pub trait PrintState<'a> {
         match lit.node {
             ast::LitKind::Str(st, style) => self.print_string(&st.as_str(), style),
             ast::LitKind::Err(st) => {
-                let st = st.as_str().escape_debug();
+                let st = st.as_str().escape_debug().to_string();
                 let mut res = String::with_capacity(st.len() + 2);
                 res.push('\'');
                 res.push_str(&st);