diff options
| author | bors <bors@rust-lang.org> | 2015-07-13 04:00:49 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-07-13 04:00:49 +0000 |
| commit | 07be6299d89b24e59514b5d3fe13abed5b17e50e (patch) | |
| tree | 6a3c3acf36068e5205104b66b011752279b0ee60 /src/test | |
| parent | 7ea2674c753b254e0eb414cac53817a400cced0a (diff) | |
| parent | 4d65ef45491b62fbecdb9a24822c216aa96bb34e (diff) | |
| download | rust-07be6299d89b24e59514b5d3fe13abed5b17e50e.tar.gz rust-07be6299d89b24e59514b5d3fe13abed5b17e50e.zip | |
Auto merge of #26947 - nagisa:unicode-escape-error, r=nrc
Inspired by the now-mysteriously-closed https://github.com/rust-lang/rust/pull/26782. This PR introduces better error messages when unicode escapes have invalid format (e.g. `\uFFFF`). It also makes rustc always tell the user that escape may not be used in byte-strings and bytes and fixes some spans to not include unecessary characters and include escape backslash in some others.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/parse-fail/issue-23620-invalid-escapes.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/test/parse-fail/issue-23620-invalid-escapes.rs b/src/test/parse-fail/issue-23620-invalid-escapes.rs index 7930ea75bf5..1790b9164b7 100644 --- a/src/test/parse-fail/issue-23620-invalid-escapes.rs +++ b/src/test/parse-fail/issue-23620-invalid-escapes.rs @@ -16,7 +16,8 @@ fn main() { //~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string let _ = b'\u'; - //~^ ERROR unknown byte escape: u + //~^ ERROR incorrect unicode escape sequence + //~^^ ERROR unicode escape sequences cannot be used as a byte or in a byte string let _ = b'\x5'; //~^ ERROR numeric character escape is too short @@ -35,11 +36,12 @@ fn main() { let _ = b"\u{a4a4} \xf \u"; //~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string //~^^ ERROR illegal character in numeric character escape: - //~^^^ ERROR unknown byte escape: u + //~^^^ 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 illegal unicode character escape //~^^ ERROR illegal character in numeric character escape: //~^^^ ERROR form of character escape may only be used with characters in the range [\x00-\x7f] - //~^^^^ ERROR unknown character escape: u + //~^^^^ ERROR incorrect unicode escape sequence } |
