2020-08-28 16:04:42 -05:00
|
|
|
// Allows to track issue #75492:
|
|
|
|
// https://github.com/rust-lang/rust/issues/75492
|
|
|
|
|
|
|
|
use std::iter;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
format!("A number: {}". iter::once(42).next().unwrap());
|
2020-08-31 04:45:50 -05:00
|
|
|
//~^ ERROR expected `,`, found `.`
|
2020-08-28 16:04:42 -05:00
|
|
|
|
|
|
|
// Other kind of types are also checked:
|
|
|
|
|
|
|
|
format!("A number: {}" / iter::once(42).next().unwrap());
|
2020-08-31 04:45:50 -05:00
|
|
|
//~^ ERROR expected `,`, found `/`
|
2020-08-28 16:04:42 -05:00
|
|
|
|
|
|
|
format!("A number: {}"; iter::once(42).next().unwrap());
|
2020-08-31 04:45:50 -05:00
|
|
|
//~^ ERROR expected `,`, found `;`
|
2020-08-28 16:04:42 -05:00
|
|
|
|
|
|
|
// Note: this character is an COMBINING COMMA BELOW unicode char
|
|
|
|
format!("A number: {}" ̦ iter::once(42).next().unwrap());
|
2020-08-31 04:45:50 -05:00
|
|
|
//~^ ERROR expected `,`, found `iter`
|
2020-08-28 16:04:42 -05:00
|
|
|
//~^^ ERROR unknown start of token: \u{326}
|
2020-08-31 04:45:50 -05:00
|
|
|
|
|
|
|
// Here recovery is tested.
|
|
|
|
// If the `compile_error!` is emitted, then the parser is able to recover
|
|
|
|
// from the incorrect first separator.
|
|
|
|
format!("{}". compile_error!("fail"));
|
|
|
|
//~^ ERROR expected `,`, found `.`
|
|
|
|
//~^^ ERROR fail
|
2020-08-28 16:04:42 -05:00
|
|
|
}
|