]> git.lizzy.rs Git - rust.git/blob - tests/ui/parser/recover-for-loop-parens-around-head.rs
Merge commit '598f0909568a51de8a2d1148f55a644fd8dffad0' into sync_cg_clif-2023-01-24
[rust.git] / tests / 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 }