]> git.lizzy.rs Git - rust.git/blob - src/test/ui/inference/cannot-infer-closure-circular.rs
Rollup merge of #82259 - osa1:issue82156, r=petrochenkov
[rust.git] / src / test / ui / inference / cannot-infer-closure-circular.rs
1 fn main() {
2     // Below we call the closure with its own return as the argument, unifying
3     // its inferred input and return types. We want to make sure that the generated
4     // error handles this gracefully, and in particular doesn't generate an extra
5     // note about the `?` operator in the closure body, which isn't relevant to
6     // the inference.
7     let x = |r| {
8         //~^ ERROR type annotations needed
9         let v = r?;
10         Ok(v)
11     };
12
13     let _ = x(x(Ok(())));
14 }