diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 72ff501c6481e..f5781e0587d24 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -777,13 +777,6 @@ impl<'a> StringReader<'a> { } } - fn old_escape_warning(&mut self, sp: Span) { - self.span_diagnostic - .span_warn(sp, "\\U00ABCD12 and \\uABCD escapes are deprecated"); - self.span_diagnostic - .fileline_help(sp, "use \\u{ABCD12} escapes instead"); - } - /// Scan for a single (possibly escaped) byte or char /// in a byte, (non-raw) byte string, char, or (non-raw) string literal. /// `start` is the position of `first_source_char`, which is already consumed. @@ -803,21 +796,8 @@ impl<'a> StringReader<'a> { return match e { 'n' | 'r' | 't' | '\\' | '\'' | '"' | '0' => true, 'x' => self.scan_byte_escape(delim, !ascii_only), - 'u' if !ascii_only => { - if self.curr == Some('{') { - self.scan_unicode_escape(delim) - } else { - let res = self.scan_hex_digits(4, delim, false); - let sp = codemap::mk_sp(escaped_pos, self.last_pos); - self.old_escape_warning(sp); - res - } - } - 'U' if !ascii_only => { - let res = self.scan_hex_digits(8, delim, false); - let sp = codemap::mk_sp(escaped_pos, self.last_pos); - self.old_escape_warning(sp); - res + 'u' if self.curr_is('{') => { + self.scan_unicode_escape(delim) } '\n' if delim == '"' => { self.consume_whitespace(); diff --git a/src/test/parse-fail/lex-bad-char-literals.rs b/src/test/parse-fail/lex-bad-char-literals.rs index fbe03e355eed6..4aa01bcde6989 100644 --- a/src/test/parse-fail/lex-bad-char-literals.rs +++ b/src/test/parse-fail/lex-bad-char-literals.rs @@ -8,36 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -static c: char = - '\u539_' //~ ERROR: illegal character in numeric character escape - //~^ WARNING: \uABCD escapes are deprecated -; - -static c2: char = - '\Uffffffff' //~ ERROR: illegal numeric character escape - //~^ WARNING: \uABCD escapes are deprecated -; - static c3: char = '\x1' //~ ERROR: numeric character escape is too short ; -static c4: char = - '\u23q' //~ ERROR: illegal character in numeric character escape - //~^ WARNING: \uABCD escapes are deprecated -; -//~^^^ ERROR: numeric character escape is too short - static s: &'static str = "\x1" //~ ERROR: numeric character escape is too short ; -static s2: &'static str = - "\u23q" //~ ERROR: illegal character in numeric character escape - //~^ ERROR: numeric character escape is too short - //~^^ WARNING: \uABCD escapes are deprecated -; - static c: char = '\●' //~ ERROR: unknown character escape ; diff --git a/src/test/pretty/block-comment-wchar.pp b/src/test/pretty/block-comment-wchar.pp index 5a55cb4e56130..a5d82277d2f94 100644 --- a/src/test/pretty/block-comment-wchar.pp +++ b/src/test/pretty/block-comment-wchar.pp @@ -105,10 +105,11 @@ fn main() { // Taken from http://www.unicode.org/Public/UNIDATA/PropList.txt let chars = - ['\x0A', '\x0B', '\x0C', '\x0D', '\x20', '\u0085', '\u00A0', '\u1680', - '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006', - '\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F', - '\u205F', '\u3000']; + ['\x0A', '\x0B', '\x0C', '\x0D', '\x20', '\u{85}', '\u{A0}', + '\u{1680}', '\u{2000}', '\u{2001}', '\u{2002}', '\u{2003}', + '\u{2004}', '\u{2005}', '\u{2006}', '\u{2007}', '\u{2008}', + '\u{2009}', '\u{200A}', '\u{2028}', '\u{2029}', '\u{202F}', + '\u{205F}', '\u{3000}']; for c in &chars { let ws = c.is_whitespace(); println!("{} {}" , c , ws); diff --git a/src/test/pretty/block-comment-wchar.rs b/src/test/pretty/block-comment-wchar.rs index c82bdcd8dcb93..eb6d2a4a0a173 100644 --- a/src/test/pretty/block-comment-wchar.rs +++ b/src/test/pretty/block-comment-wchar.rs @@ -99,10 +99,11 @@ fn f() { fn main() { // Taken from http://www.unicode.org/Public/UNIDATA/PropList.txt let chars = - ['\x0A', '\x0B', '\x0C', '\x0D', '\x20', '\u0085', '\u00A0', '\u1680', - '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006', - '\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F', - '\u205F', '\u3000']; + ['\x0A', '\x0B', '\x0C', '\x0D', '\x20', '\u{85}', '\u{A0}', + '\u{1680}', '\u{2000}', '\u{2001}', '\u{2002}', '\u{2003}', + '\u{2004}', '\u{2005}', '\u{2006}', '\u{2007}', '\u{2008}', + '\u{2009}', '\u{200A}', '\u{2028}', '\u{2029}', '\u{202F}', + '\u{205F}', '\u{3000}']; for c in &chars { let ws = c.is_whitespace(); println!("{} {}", c , ws); diff --git a/src/test/run-pass/nul-characters.rs b/src/test/run-pass/nul-characters.rs index 22786c0abc89b..4a14969209f02 100644 --- a/src/test/run-pass/nul-characters.rs +++ b/src/test/run-pass/nul-characters.rs @@ -10,10 +10,10 @@ pub fn main() { - let all_nuls1 = "\0\x00\u0000\U00000000"; - let all_nuls2 = "\U00000000\u0000\x00\0"; - let all_nuls3 = "\u0000\U00000000\x00\0"; - let all_nuls4 = "\x00\u0000\0\U00000000"; + let all_nuls1 = "\0\x00\u{0}\u{0}"; + let all_nuls2 = "\u{0}\u{0}\x00\0"; + let all_nuls3 = "\u{0}\u{0}\x00\0"; + let all_nuls4 = "\x00\u{0}\0\u{0}"; // sizes for two should suffice assert_eq!(all_nuls1.len(), 4); @@ -35,8 +35,8 @@ pub fn main() // testing equality between explicit character literals assert_eq!('\0', '\x00'); - assert_eq!('\u0000', '\x00'); - assert_eq!('\u0000', '\U00000000'); + assert_eq!('\u{0}', '\x00'); + assert_eq!('\u{0}', '\u{0}'); // NUL characters should make a difference assert!("Hello World" != "Hello \0World"); diff --git a/src/test/run-pass/raw-str.rs b/src/test/run-pass/raw-str.rs index 35e863d05a177..298ac8f77eb11 100644 Binary files a/src/test/run-pass/raw-str.rs and b/src/test/run-pass/raw-str.rs differ diff --git a/src/test/run-pass/utf8.rs b/src/test/run-pass/utf8.rs index 96bba01068f2b..4be54bd7080d2 100644 --- a/src/test/run-pass/utf8.rs +++ b/src/test/run-pass/utf8.rs @@ -24,7 +24,7 @@ pub fn main() { assert_eq!(y_diaeresis as int, 0xff); assert_eq!(pi as int, 0x3a0); - assert_eq!(pi as int, '\u03a0' as int); + assert_eq!(pi as int, '\u{3a0}' as int); assert_eq!('\x0a' as int, '\n' as int); let bhutan: String = "འབྲུག་ཡུལ།".to_string(); @@ -33,11 +33,11 @@ pub fn main() { let austria: String = "Österreich".to_string(); let bhutan_e: String = - "\u0f60\u0f56\u0fb2\u0f74\u0f42\u0f0b\u0f61\u0f74\u0f63\u0f0d".to_string(); - let japan_e: String = "\u65e5\u672c".to_string(); + "\u{f60}\u{f56}\u{fb2}\u{f74}\u{f42}\u{f0b}\u{f61}\u{f74}\u{f63}\u{f0d}".to_string(); + let japan_e: String = "\u{65e5}\u{672c}".to_string(); let uzbekistan_e: String = - "\u040e\u0437\u0431\u0435\u043a\u0438\u0441\u0442\u043e\u043d".to_string(); - let austria_e: String = "\u00d6sterreich".to_string(); + "\u{40e}\u{437}\u{431}\u{435}\u{43a}\u{438}\u{441}\u{442}\u{43e}\u{43d}".to_string(); + let austria_e: String = "\u{d6}sterreich".to_string(); let oo: char = 'Ö'; assert_eq!(oo as int, 0xd6); diff --git a/src/test/run-pass/utf8_chars.rs b/src/test/run-pass/utf8_chars.rs index 88369f2e500b1..c54b3b69c6880 100644 --- a/src/test/run-pass/utf8_chars.rs +++ b/src/test/run-pass/utf8_chars.rs @@ -14,7 +14,7 @@ use std::str; pub fn main() { // Chars of 1, 2, 3, and 4 bytes - let chs: Vec = vec!('e', 'é', '€', '\U00010000'); + let chs: Vec = vec!('e', 'é', '€', '\u{10000}'); let s: String = chs.iter().cloned().collect(); let schs: Vec = s.chars().collect();