]> git.lizzy.rs Git - rust.git/blob - src/test/parse-fail/issue-23620-invalid-escapes.rs
Auto merge of #52984 - fabric-and-ink:remove-canonical-var, r=scalexm
[rust.git] / src / test / parse-fail / issue-23620-invalid-escapes.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // compile-flags: -Z parse-only -Z continue-parse-after-error
12
13 fn main() {
14     let _ = b"\u{a66e}";
15     //~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
16
17     let _ = b'\u{a66e}';
18     //~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
19
20     let _ = b'\u';
21     //~^ ERROR incorrect unicode escape sequence
22     //~^^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
23
24     let _ = b'\x5';
25     //~^ ERROR numeric character escape is too short
26
27     let _ = b'\xxy';
28     //~^ ERROR invalid character in numeric character escape: x
29     //~^^ ERROR invalid character in numeric character escape: y
30
31     let _ = '\x5';
32     //~^ ERROR numeric character escape is too short
33
34     let _ = '\xxy';
35     //~^ ERROR invalid character in numeric character escape: x
36     //~^^ ERROR invalid character in numeric character escape: y
37
38     let _ = b"\u{a4a4} \xf \u";
39     //~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
40     //~^^ ERROR invalid character in numeric character escape:
41     //~^^^ ERROR incorrect unicode escape sequence
42     //~^^^^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
43
44     let _ = "\xf \u";
45     //~^ ERROR invalid character in numeric character escape:
46     //~^^ ERROR form of character escape may only be used with characters in the range [\x00-\x7f]
47     //~^^^ ERROR incorrect unicode escape sequence
48 }