diff options
| author | Malo Jaffré <jaffre.malo@gmail.com> | 2017-08-17 20:02:13 +0200 |
|---|---|---|
| committer | Malo Jaffré <jaffre.malo@gmail.com> | 2017-08-17 20:03:32 +0200 |
| commit | d4e0e5228111cd47294342a60b5f8af44c65e206 (patch) | |
| tree | 5364e51b1733e40ff74fb64564ff76e2603e2778 /src/test/parse-fail | |
| parent | dd39ecf368a3cdb937e129f36a2a342d0c9358f0 (diff) | |
| download | rust-d4e0e5228111cd47294342a60b5f8af44c65e206.tar.gz rust-d4e0e5228111cd47294342a60b5f8af44c65e206.zip | |
Accept underscores in unicode escapes
Fixes #43692.
Diffstat (limited to 'src/test/parse-fail')
| -rw-r--r-- | src/test/parse-fail/issue-23620-invalid-escapes.rs | 9 | ||||
| -rw-r--r-- | src/test/parse-fail/issue-43692.rs | 15 | ||||
| -rw-r--r-- | src/test/parse-fail/new-unicode-escapes-2.rs | 2 | ||||
| -rw-r--r-- | src/test/parse-fail/new-unicode-escapes-3.rs | 3 | ||||
| -rw-r--r-- | src/test/parse-fail/new-unicode-escapes-4.rs | 2 |
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 } |
