]> git.lizzy.rs Git - rust.git/blob - tests/ui/inference/cannot-infer-closure-circular.rs
Rollup merge of #106835 - compiler-errors:new-solver-gat-rebase-oops, r=lcnr
[rust.git] / tests / 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| { //~ ERROR type annotations needed for `Result<(), E>`
8         let v = r?;
9         Ok(v)
10     };
11
12     let _ = x(x(Ok(())));
13 }