]> git.lizzy.rs Git - rust.git/blob - src/test/ui/parser/recover-for-loop-parens-around-head.rs
Rollup merge of #90345 - passcod:entry-insert, r=dtolnay
[rust.git] / src / test / ui / parser / recover-for-loop-parens-around-head.rs
1 // Here we test that the parser is able to recover in a situation like
2 // `for ( $pat in $expr )` since that is familiar syntax in other languages.
3 // Instead we suggest that the user writes `for $pat in $expr`.
4
5 #![deny(unused)] // Make sure we don't trigger `unused_parens`.
6
7 fn main() {
8     let vec = vec![1, 2, 3];
9
10     for ( elem in vec ) {
11         //~^ ERROR expected one of `)`, `,`, `@`, or `|`, found keyword `in`
12         //~| ERROR unexpected parentheses surrounding `for` loop head
13         const RECOVERY_WITNESS: () = 0; //~ ERROR mismatched types
14     }
15 }