diff options
Diffstat (limited to 'tests/ui/cast/cast-char.rs')
-rw-r--r-- | tests/ui/cast/cast-char.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/ui/cast/cast-char.rs b/tests/ui/cast/cast-char.rs new file mode 100644 index 000000000..9634ed56f --- /dev/null +++ b/tests/ui/cast/cast-char.rs @@ -0,0 +1,10 @@ +#![deny(overflowing_literals)] + +fn main() { + const XYZ: char = 0x1F888 as char; + //~^ ERROR only `u8` can be cast into `char` + const XY: char = 129160 as char; + //~^ ERROR only `u8` can be cast into `char` + const ZYX: char = '\u{01F888}'; + println!("{}", XYZ); +} |