mirror of https://github.com/rust-lang/rust
43 lines
1.9 KiB
Rust
43 lines
1.9 KiB
Rust
//@ edition: 2021
|
||
|
||
// The null char check for C string literals was originally implemented after
|
||
// expansion, which meant the first five strings in this file triggered errors,
|
||
// and the remaining ten did not. But this is different to all the other
|
||
// content checks done on string literals, such as checks for invalid escapes
|
||
// and bare CR chars. So the check was moved earlier. The check can be moved
|
||
// back to after expansion at a later date if necessary, because that would be
|
||
// a backward compatible change. (In contrast, moving the check from after
|
||
// expansion to lexing time would be a backward incompatible change, because it
|
||
// could break code that was previously accepted.)
|
||
|
||
fn main() {
|
||
c"\0"; //~ ERROR null characters in C string literals
|
||
c"\u{00}"; //~ ERROR null characters in C string literals
|
||
c" |