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