rust/tests/ui/lexer/issue-108019-bad-emoji-recovery.rs
许杰友 Jieyou Xu (Joe) 380fa26413
Don't recover lifetimes/labels containing emojis as character literals
Note that at the time of this commit, `unic-emoji-char` seems to have
data tables only up to Unicode 5.0, but Unicode is already newer than
this.

A newer emoji such as `🥺` will not be recognized as an emoji
but older emojis such as `🐱` will.
2023-02-14 17:31:58 +08:00

46 lines
896 B
Rust

#![allow(unused_labels)]
// FIXME(#108019): outdated Unicode table
// fn foo() {
// '🥺 loop {
// break
// }
// }
fn bar() {
'🐱 loop {
//~^ ERROR labeled expression must be followed by `:`
//~| ERROR lifetimes or labels cannot contain emojis
break
}
}
fn qux() {
'a🐱 loop {
//~^ ERROR labeled expression must be followed by `:`
//~| ERROR lifetimes or labels cannot contain emojis
break
}
}
fn quux() {
'1🐱 loop {
//~^ ERROR labeled expression must be followed by `:`
//~| ERROR lifetimes or labels cannot start with a number
break
}
}
fn x<'🐱>() -> &'🐱 () {
//~^ ERROR lifetimes or labels cannot contain emojis
//~| ERROR lifetimes or labels cannot contain emojis
&()
}
fn y() {
'a🐱: loop {}
//~^ ERROR lifetimes or labels cannot contain emojis
}
fn main() {}