]> git.lizzy.rs Git - rust.git/blob - tests/ui/fmt/incorrect-separator.rs
Rollup merge of #105784 - yanns:update_stdarch, r=Amanieu
[rust.git] / tests / ui / fmt / incorrect-separator.rs
1 // Allows to track issue #75492:
2 // https://github.com/rust-lang/rust/issues/75492
3
4 use std::iter;
5
6 fn main() {
7     format!("A number: {}". iter::once(42).next().unwrap());
8     //~^ ERROR expected `,`, found `.`
9
10     // Other kind of types are also checked:
11
12     format!("A number: {}" / iter::once(42).next().unwrap());
13     //~^ ERROR expected `,`, found `/`
14
15     format!("A number: {}"; iter::once(42).next().unwrap());
16     //~^ ERROR expected `,`, found `;`
17
18     // Note: this character is an COMBINING COMMA BELOW unicode char
19     format!("A number: {}" ̦ iter::once(42).next().unwrap());
20     //~^ ERROR expected `,`, found `iter`
21     //~^^ ERROR unknown start of token: \u{326}
22
23     // Here recovery is tested.
24     // If the `compile_error!` is emitted, then the parser is able to recover
25     // from the incorrect first separator.
26     format!("{}". compile_error!("fail"));
27     //~^ ERROR expected `,`, found `.`
28     //~^^ ERROR fail
29 }