Skip to content

Commit 098daa1

Browse files
committed
Auto merge of #23132 - alexcrichton:remove-deprecated-unicode-escapes, r=huonw
These have been deprecated for quite some time, so we should be good to remove them now.
2 parents 270a677 + 39e2c69 commit 098daa1

File tree

8 files changed

+24
-64
lines changed

8 files changed

+24
-64
lines changed

Diff for: src/libsyntax/parse/lexer/mod.rs

+2-22
Original file line numberDiff line numberDiff line change
@@ -777,13 +777,6 @@ impl<'a> StringReader<'a> {
777777
}
778778
}
779779

780-
fn old_escape_warning(&mut self, sp: Span) {
781-
self.span_diagnostic
782-
.span_warn(sp, "\\U00ABCD12 and \\uABCD escapes are deprecated");
783-
self.span_diagnostic
784-
.fileline_help(sp, "use \\u{ABCD12} escapes instead");
785-
}
786-
787780
/// Scan for a single (possibly escaped) byte or char
788781
/// in a byte, (non-raw) byte string, char, or (non-raw) string literal.
789782
/// `start` is the position of `first_source_char`, which is already consumed.
@@ -803,21 +796,8 @@ impl<'a> StringReader<'a> {
803796
return match e {
804797
'n' | 'r' | 't' | '\\' | '\'' | '"' | '0' => true,
805798
'x' => self.scan_byte_escape(delim, !ascii_only),
806-
'u' if !ascii_only => {
807-
if self.curr == Some('{') {
808-
self.scan_unicode_escape(delim)
809-
} else {
810-
let res = self.scan_hex_digits(4, delim, false);
811-
let sp = codemap::mk_sp(escaped_pos, self.last_pos);
812-
self.old_escape_warning(sp);
813-
res
814-
}
815-
}
816-
'U' if !ascii_only => {
817-
let res = self.scan_hex_digits(8, delim, false);
818-
let sp = codemap::mk_sp(escaped_pos, self.last_pos);
819-
self.old_escape_warning(sp);
820-
res
799+
'u' if self.curr_is('{') => {
800+
self.scan_unicode_escape(delim)
821801
}
822802
'\n' if delim == '"' => {
823803
self.consume_whitespace();

Diff for: src/test/parse-fail/lex-bad-char-literals.rs

-22
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,14 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
static c: char =
12-
'\u539_' //~ ERROR: illegal character in numeric character escape
13-
//~^ WARNING: \uABCD escapes are deprecated
14-
;
15-
16-
static c2: char =
17-
'\Uffffffff' //~ ERROR: illegal numeric character escape
18-
//~^ WARNING: \uABCD escapes are deprecated
19-
;
20-
2111
static c3: char =
2212
'\x1' //~ ERROR: numeric character escape is too short
2313
;
2414

25-
static c4: char =
26-
'\u23q' //~ ERROR: illegal character in numeric character escape
27-
//~^ WARNING: \uABCD escapes are deprecated
28-
;
29-
//~^^^ ERROR: numeric character escape is too short
30-
3115
static s: &'static str =
3216
"\x1" //~ ERROR: numeric character escape is too short
3317
;
3418

35-
static s2: &'static str =
36-
"\u23q" //~ ERROR: illegal character in numeric character escape
37-
//~^ ERROR: numeric character escape is too short
38-
//~^^ WARNING: \uABCD escapes are deprecated
39-
;
40-
4119
static c: char =
4220
'\●' //~ ERROR: unknown character escape
4321
;

Diff for: src/test/pretty/block-comment-wchar.pp

+5-4
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,11 @@
105105
fn main() {
106106
// Taken from http://www.unicode.org/Public/UNIDATA/PropList.txt
107107
let chars =
108-
['\x0A', '\x0B', '\x0C', '\x0D', '\x20', '\u0085', '\u00A0', '\u1680',
109-
'\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006',
110-
'\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F',
111-
'\u205F', '\u3000'];
108+
['\x0A', '\x0B', '\x0C', '\x0D', '\x20', '\u{85}', '\u{A0}',
109+
'\u{1680}', '\u{2000}', '\u{2001}', '\u{2002}', '\u{2003}',
110+
'\u{2004}', '\u{2005}', '\u{2006}', '\u{2007}', '\u{2008}',
111+
'\u{2009}', '\u{200A}', '\u{2028}', '\u{2029}', '\u{202F}',
112+
'\u{205F}', '\u{3000}'];
112113
for c in &chars {
113114
let ws = c.is_whitespace();
114115
println!("{} {}" , c , ws);

Diff for: src/test/pretty/block-comment-wchar.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,11 @@ fn f() {
9999
fn main() {
100100
// Taken from http://www.unicode.org/Public/UNIDATA/PropList.txt
101101
let chars =
102-
['\x0A', '\x0B', '\x0C', '\x0D', '\x20', '\u0085', '\u00A0', '\u1680',
103-
'\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006',
104-
'\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F',
105-
'\u205F', '\u3000'];
102+
['\x0A', '\x0B', '\x0C', '\x0D', '\x20', '\u{85}', '\u{A0}',
103+
'\u{1680}', '\u{2000}', '\u{2001}', '\u{2002}', '\u{2003}',
104+
'\u{2004}', '\u{2005}', '\u{2006}', '\u{2007}', '\u{2008}',
105+
'\u{2009}', '\u{200A}', '\u{2028}', '\u{2029}', '\u{202F}',
106+
'\u{205F}', '\u{3000}'];
106107
for c in &chars {
107108
let ws = c.is_whitespace();
108109
println!("{} {}", c , ws);

Diff for: src/test/run-pass/nul-characters.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
pub fn main()
1212
{
13-
let all_nuls1 = "\0\x00\u0000\U00000000";
14-
let all_nuls2 = "\U00000000\u0000\x00\0";
15-
let all_nuls3 = "\u0000\U00000000\x00\0";
16-
let all_nuls4 = "\x00\u0000\0\U00000000";
13+
let all_nuls1 = "\0\x00\u{0}\u{0}";
14+
let all_nuls2 = "\u{0}\u{0}\x00\0";
15+
let all_nuls3 = "\u{0}\u{0}\x00\0";
16+
let all_nuls4 = "\x00\u{0}\0\u{0}";
1717

1818
// sizes for two should suffice
1919
assert_eq!(all_nuls1.len(), 4);
@@ -35,8 +35,8 @@ pub fn main()
3535

3636
// testing equality between explicit character literals
3737
assert_eq!('\0', '\x00');
38-
assert_eq!('\u0000', '\x00');
39-
assert_eq!('\u0000', '\U00000000');
38+
assert_eq!('\u{0}', '\x00');
39+
assert_eq!('\u{0}', '\u{0}');
4040

4141
// NUL characters should make a difference
4242
assert!("Hello World" != "Hello \0World");

Diff for: src/test/run-pass/raw-str.rs

2 Bytes
Binary file not shown.

Diff for: src/test/run-pass/utf8.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn main() {
2424
assert_eq!(y_diaeresis as int, 0xff);
2525
assert_eq!(pi as int, 0x3a0);
2626

27-
assert_eq!(pi as int, '\u03a0' as int);
27+
assert_eq!(pi as int, '\u{3a0}' as int);
2828
assert_eq!('\x0a' as int, '\n' as int);
2929

3030
let bhutan: String = "འབྲུག་ཡུལ།".to_string();
@@ -33,11 +33,11 @@ pub fn main() {
3333
let austria: String = "Österreich".to_string();
3434

3535
let bhutan_e: String =
36-
"\u0f60\u0f56\u0fb2\u0f74\u0f42\u0f0b\u0f61\u0f74\u0f63\u0f0d".to_string();
37-
let japan_e: String = "\u65e5\u672c".to_string();
36+
"\u{f60}\u{f56}\u{fb2}\u{f74}\u{f42}\u{f0b}\u{f61}\u{f74}\u{f63}\u{f0d}".to_string();
37+
let japan_e: String = "\u{65e5}\u{672c}".to_string();
3838
let uzbekistan_e: String =
39-
"\u040e\u0437\u0431\u0435\u043a\u0438\u0441\u0442\u043e\u043d".to_string();
40-
let austria_e: String = "\u00d6sterreich".to_string();
39+
"\u{40e}\u{437}\u{431}\u{435}\u{43a}\u{438}\u{441}\u{442}\u{43e}\u{43d}".to_string();
40+
let austria_e: String = "\u{d6}sterreich".to_string();
4141

4242
let oo: char = 'Ö';
4343
assert_eq!(oo as int, 0xd6);

Diff for: src/test/run-pass/utf8_chars.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::str;
1414

1515
pub fn main() {
1616
// Chars of 1, 2, 3, and 4 bytes
17-
let chs: Vec<char> = vec!('e', 'é', '€', '\U00010000');
17+
let chs: Vec<char> = vec!('e', 'é', '€', '\u{10000}');
1818
let s: String = chs.iter().cloned().collect();
1919
let schs: Vec<char> = s.chars().collect();
2020

0 commit comments

Comments
 (0)