about summary refs log tree commit diff
path: root/src/test/parse-fail
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-09-12 01:25:23 +0000
committerbors <bors@rust-lang.org>2017-09-12 01:25:23 +0000
commit11f64d8f881a8bd994210efc1d3ff1982abf9df3 (patch)
tree2750d4d4f6fc74996727fec47fe1e79c2d58fde8 /src/test/parse-fail
parent07d950f38f1719e2a54d9a515178b0e11dbaf108 (diff)
parentd4e0e5228111cd47294342a60b5f8af44c65e206 (diff)
Auto merge of #43716 - MaloJaffre:_-in-literals, r=petrochenkov
Accept underscores in unicode escapes

Fixes #43692.

I don't know if this need an RFC, but at least the impl is here!
Diffstat (limited to 'src/test/parse-fail')
-rw-r--r--src/test/parse-fail/issue-23620-invalid-escapes.rs9
-rw-r--r--src/test/parse-fail/issue-43692.rs15
-rw-r--r--src/test/parse-fail/new-unicode-escapes-2.rs2
-rw-r--r--src/test/parse-fail/new-unicode-escapes-3.rs3
-rw-r--r--src/test/parse-fail/new-unicode-escapes-4.rs2
5 files changed, 22 insertions, 9 deletions
diff --git a/src/test/parse-fail/issue-23620-invalid-escapes.rs b/src/test/parse-fail/issue-23620-invalid-escapes.rs
index 821149d1d00..dfeaae49002 100644
--- a/src/test/parse-fail/issue-23620-invalid-escapes.rs
+++ b/src/test/parse-fail/issue-23620-invalid-escapes.rs
@@ -41,9 +41,8 @@ fn main() {
     //~^^^ ERROR incorrect unicode escape sequence
     //~^^^^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
 
-    let _ = "\u{ffffff} \xf \u";
-    //~^ ERROR invalid unicode character escape
-    //~^^ ERROR invalid character in numeric character escape:
-    //~^^^ ERROR form of character escape may only be used with characters in the range [\x00-\x7f]
-    //~^^^^ ERROR incorrect unicode escape sequence
+    let _ = "\xf \u";
+    //~^ ERROR invalid character in numeric character escape:
+    //~^^ ERROR form of character escape may only be used with characters in the range [\x00-\x7f]
+    //~^^^ ERROR incorrect unicode escape sequence
 }
diff --git a/src/test/parse-fail/issue-43692.rs b/src/test/parse-fail/issue-43692.rs
new file mode 100644
index 00000000000..eb5d050e102
--- /dev/null
+++ b/src/test/parse-fail/issue-43692.rs
@@ -0,0 +1,15 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -Z parse-only
+
+fn main() {
+    '\u{_10FFFF}'; //~ ERROR invalid start of unicode escape
+}
diff --git a/src/test/parse-fail/new-unicode-escapes-2.rs b/src/test/parse-fail/new-unicode-escapes-2.rs
index 3eaea86b8bc..cdadaef1b59 100644
--- a/src/test/parse-fail/new-unicode-escapes-2.rs
+++ b/src/test/parse-fail/new-unicode-escapes-2.rs
@@ -11,5 +11,5 @@
 // compile-flags: -Z parse-only
 
 pub fn main() {
-    let s = "\u{260311111111}"; //~ ERROR overlong unicode escape (can have at most 6 hex digits)
+    let s = "\u{260311111111}"; //~ ERROR overlong unicode escape (must have at most 6 hex digits)
 }
diff --git a/src/test/parse-fail/new-unicode-escapes-3.rs b/src/test/parse-fail/new-unicode-escapes-3.rs
index d12bb63111b..8189bf67712 100644
--- a/src/test/parse-fail/new-unicode-escapes-3.rs
+++ b/src/test/parse-fail/new-unicode-escapes-3.rs
@@ -11,5 +11,6 @@
 // compile-flags: -Z parse-only
 
 pub fn main() {
-    let s = "\u{d805}"; //~ ERROR invalid unicode character escape
+    let s1 = "\u{d805}"; //~ ERROR invalid unicode character escape
+    let s2 = "\u{ffffff}"; //~ ERROR invalid unicode character escape
 }
diff --git a/src/test/parse-fail/new-unicode-escapes-4.rs b/src/test/parse-fail/new-unicode-escapes-4.rs
index 5615ac8df01..8770fb319df 100644
--- a/src/test/parse-fail/new-unicode-escapes-4.rs
+++ b/src/test/parse-fail/new-unicode-escapes-4.rs
@@ -13,6 +13,4 @@
 pub fn main() {
     let s = "\u{lol}";
      //~^ ERROR invalid character in unicode escape: l
-     //~^^ ERROR invalid character in unicode escape: o
-     //~^^^ ERROR invalid character in unicode escape: l
 }