]> git.proxmox.com Git - rustc.git/blame - src/test/parse-fail/issue-23620-invalid-escapes.rs
Imported Upstream version 1.3.0+dfsg1
[rustc.git] / src / test / parse-fail / issue-23620-invalid-escapes.rs
CommitLineData
c34b1796
AL
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
11fn main() {
12 let _ = b"\u{a66e}";
13 //~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
14
15 let _ = b'\u{a66e}';
16 //~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
17
18 let _ = b'\u';
c1a9b12d
SL
19 //~^ ERROR incorrect unicode escape sequence
20 //~^^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
c34b1796
AL
21
22 let _ = b'\x5';
23 //~^ ERROR numeric character escape is too short
24
25 let _ = b'\xxy';
c1a9b12d
SL
26 //~^ ERROR invalid character in numeric character escape: x
27 //~^^ ERROR invalid character in numeric character escape: y
c34b1796
AL
28
29 let _ = '\x5';
30 //~^ ERROR numeric character escape is too short
31
32 let _ = '\xxy';
c1a9b12d
SL
33 //~^ ERROR invalid character in numeric character escape: x
34 //~^^ ERROR invalid character in numeric character escape: y
c34b1796
AL
35
36 let _ = b"\u{a4a4} \xf \u";
37 //~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
c1a9b12d
SL
38 //~^^ ERROR invalid character in numeric character escape:
39 //~^^^ ERROR incorrect unicode escape sequence
40 //~^^^^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
c34b1796
AL
41
42 let _ = "\u{ffffff} \xf \u";
c1a9b12d
SL
43 //~^ ERROR invalid unicode character escape
44 //~^^ ERROR invalid character in numeric character escape:
c34b1796 45 //~^^^ ERROR form of character escape may only be used with characters in the range [\x00-\x7f]
c1a9b12d 46 //~^^^^ ERROR incorrect unicode escape sequence
c34b1796 47}