about summary refs log tree commit diff
path: root/src/libstd/lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-07-28 11:20:33 -0700
committerGitHub <noreply@github.com>2016-07-28 11:20:33 -0700
commitd1df3fecdf8dc959fbd8901603a16e5bc0bfa21d (patch)
tree52351065a422a440701808df99b4f476058eb2fb /src/libstd/lib.rs
parent748ecb1235d1cfa1aeaa0e5424c454837089f6cc (diff)
parent3d09b4a0d58200da84fe19cd3b0003d61e5b1791 (diff)
downloadrust-d1df3fecdf8dc959fbd8901603a16e5bc0bfa21d.tar.gz
rust-d1df3fecdf8dc959fbd8901603a16e5bc0bfa21d.zip
Auto merge of #34485 - tbu-:pr_unicode_debug_str, r=alexcrichton
Escape fewer Unicode codepoints in `Debug` impl of `str`

Use the same procedure as Python to determine whether a character is
printable, described in [PEP 3138]. In particular, this means that the
following character classes are escaped:

- Cc (Other, Control)
- Cf (Other, Format)
- Cs (Other, Surrogate), even though they can't appear in Rust strings
- Co (Other, Private Use)
- Cn (Other, Not Assigned)
- Zl (Separator, Line)
- Zp (Separator, Paragraph)
- Zs (Separator, Space), except for the ASCII space `' '` `0x20`

This allows for user-friendly inspection of strings that are not
English (e.g. compare `"\u{e9}\u{e8}\u{ea}"` to `"éèê"`).

Fixes #34318.
CC #34422.

[PEP 3138]: https://www.python.org/dev/peps/pep-3138/
Diffstat (limited to 'src/libstd/lib.rs')
-rw-r--r--src/libstd/lib.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index d05a5a09614..865d067cdb6 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -218,8 +218,9 @@
 #![feature(associated_consts)]
 #![feature(borrow_state)]
 #![feature(box_syntax)]
-#![feature(cfg_target_vendor)]
 #![feature(cfg_target_thread_local)]
+#![feature(cfg_target_vendor)]
+#![feature(char_escape_debug)]
 #![feature(char_internals)]
 #![feature(collections)]
 #![feature(collections_bound)]
@@ -229,10 +230,10 @@
 #![feature(dropck_parametricity)]
 #![feature(float_extras)]
 #![feature(float_from_str_radix)]
-#![feature(fnbox)]
 #![feature(fn_traits)]
-#![feature(heap_api)]
+#![feature(fnbox)]
 #![feature(hashmap_hasher)]
+#![feature(heap_api)]
 #![feature(inclusive_range)]
 #![feature(int_error_internals)]
 #![feature(into_cow)]
@@ -242,6 +243,7 @@
 #![feature(linkage)]
 #![feature(macro_reexport)]
 #![cfg_attr(test, feature(map_values_mut))]
+#![feature(needs_panic_runtime)]
 #![feature(num_bits_bytes)]
 #![feature(old_wrapping)]
 #![feature(on_unimplemented)]
@@ -249,10 +251,11 @@
 #![feature(optin_builtin_traits)]
 #![feature(panic_unwind)]
 #![feature(placement_in_syntax)]
+#![feature(question_mark)]
 #![feature(rand)]
 #![feature(raw)]
-#![feature(repr_simd)]
 #![feature(reflect_marker)]
+#![feature(repr_simd)]
 #![feature(rustc_attrs)]
 #![feature(shared)]
 #![feature(sip_hash_13)]
@@ -266,6 +269,7 @@
 #![feature(str_utf16)]
 #![feature(test, rustc_private)]
 #![feature(thread_local)]
+#![feature(try_from)]
 #![feature(unboxed_closures)]
 #![feature(unicode)]
 #![feature(unique)]
@@ -273,9 +277,6 @@
 #![feature(unwind_attributes)]
 #![feature(vec_push_all)]
 #![feature(zero_one)]
-#![feature(question_mark)]
-#![feature(try_from)]
-#![feature(needs_panic_runtime)]
 
 // Issue# 30592: Systematically use alloc_system during stage0 since jemalloc
 // might be unavailable or disabled