about summary refs log tree commit diff
path: root/src/libsyntax/lib.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2018-05-02 11:50:21 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2018-05-03 10:31:39 +1000
commitd5d389e4f11b1fad2d42453942f81271bbddee78 (patch)
tree72bdd392052191eb5683d5923bdea6b8433f98f3 /src/libsyntax/lib.rs
parentf76f6fbdea497c3cb536e33387f405cc74b99b76 (diff)
downloadrust-d5d389e4f11b1fad2d42453942f81271bbddee78.tar.gz
rust-d5d389e4f11b1fad2d42453942f81271bbddee78.zip
Use escape_default() for strings in LitKind::token().
This avoids converting every char to \u{...} form, which bloats the
resulting strings unnecessarily. It also provides consistency with the
existing escape_default() calls in LitKind::token() used for raw
string literals, char literals, and raw byte char literals.

There are two benefits from this change.

- Compilation is faster. Most of the rustc-perf benchmarks see a
  non-trivial speedup, particularly for incremental rebuilds, with the
  best speedup over 13%, and multiple others over 10%.

- Generated rlibs are smaller. An extreme example is libfutures.rlib,
  which shrinks from 2073306 bytes to 1765927 bytes, a 15% reduction.
Diffstat (limited to 'src/libsyntax/lib.rs')
-rw-r--r--src/libsyntax/lib.rs1
1 files changed, 1 insertions, 0 deletions
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"]