2024-05-18 11:08:11 -05:00
|
|
|
// Note: it's ok to interpret 'a as 'a', but not ok to interpret 'abc as
|
2024-01-28 16:47:02 -06:00
|
|
|
// 'abc' because 'abc' is not a valid char literal.
|
|
|
|
|
2022-09-01 13:48:09 -05:00
|
|
|
fn main() {
|
|
|
|
let c = 'a;
|
|
|
|
//~^ ERROR expected `while`, `for`, `loop` or `{` after a label
|
|
|
|
//~| HELP add `'` to close the char literal
|
2024-01-28 16:47:02 -06:00
|
|
|
|
|
|
|
let c = 'abc;
|
|
|
|
//~^ ERROR expected `while`, `for`, `loop` or `{` after a label
|
|
|
|
//~| ERROR expected expression, found `;`
|
|
|
|
}
|
|
|
|
|
|
|
|
fn f() {
|
|
|
|
match 'a' {
|
2022-09-01 13:48:09 -05:00
|
|
|
'a'..='b => {}
|
|
|
|
//~^ ERROR unexpected token: `'b`
|
|
|
|
//~| HELP add `'` to close the char literal
|
2024-01-28 16:47:02 -06:00
|
|
|
'c'..='def => {}
|
|
|
|
//~^ ERROR unexpected token: `'def`
|
2022-09-01 13:48:09 -05:00
|
|
|
}
|
2024-01-28 16:47:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn g() {
|
|
|
|
match 'g' {
|
|
|
|
'g => {}
|
|
|
|
//~^ ERROR expected pattern, found `=>`
|
|
|
|
//~| HELP add `'` to close the char literal
|
|
|
|
'hij => {}
|
|
|
|
//~^ ERROR expected pattern, found `'hij`
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn h() {
|
|
|
|
let x = ['a, 'b, 'cde];
|
|
|
|
//~^ ERROR expected `while`, `for`, `loop` or `{` after a label
|
|
|
|
//~| HELP add `'` to close the char literal
|
|
|
|
//~| ERROR expected `while`, `for`, `loop` or `{` after a label
|
|
|
|
//~| HELP add `'` to close the char literal
|
|
|
|
//~| ERROR expected `while`, `for`, `loop` or `{` after a label
|
|
|
|
//~| ERROR expected expression, found `]`
|
2022-09-01 13:48:09 -05:00
|
|
|
}
|