]> git.lizzy.rs Git - rust.git/blob - src/test/ui/inference/question-mark-type-infer.rs
Rollup merge of #90277 - pierwill:fix-70258-inference-terms, r=jackh726
[rust.git] / src / test / ui / inference / question-mark-type-infer.rs
1 #![feature(question_mark, question_mark_carrier)]
2
3 // Test that type inference fails where there are multiple possible return types
4 // for the `?` operator.
5
6 fn f(x: &i32) -> Result<i32, ()> {
7     Ok(*x)
8 }
9
10 fn g() -> Result<Vec<i32>, ()> {
11     let l = [1, 2, 3, 4];
12     l.iter().map(f).collect()? //~ ERROR type annotations needed
13 }
14
15 fn main() {
16     g();
17 }