]> git.lizzy.rs Git - rust.git/blob - src/test/ui/inference/question-mark-type-infer.rs
selection failure: recompute applicable impls
[rust.git] / src / test / ui / inference / question-mark-type-infer.rs
1 // Test that type inference fails where there are multiple possible return types
2 // for the `?` operator.
3
4 fn f(x: &i32) -> Result<i32, ()> {
5     Ok(*x)
6 }
7
8 fn g() -> Result<Vec<i32>, ()> {
9     let l = [1, 2, 3, 4];
10     l.iter().map(f).collect()?
11     //~^ ERROR type annotations needed
12 }
13
14 fn main() {
15     g();
16 }