]> git.proxmox.com Git - rustc.git/blob - src/test/ui/inference/question-mark-type-infer.rs
New upstream version 1.67.1+dfsg1
[rustc.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 }