mirror of https://github.com/rust-lang/rust
17 lines
311 B
Rust
17 lines
311 B
Rust
// Test that type inference fails where there are multiple possible return types
|
|
// for the `?` operator.
|
|
|
|
fn f(x: &i32) -> Result<i32, ()> {
|
|
Ok(*x)
|
|
}
|
|
|
|
fn g() -> Result<Vec<i32>, ()> {
|
|
let l = [1, 2, 3, 4];
|
|
l.iter().map(f).collect()?
|
|
//~^ ERROR type annotations needed
|
|
}
|
|
|
|
fn main() {
|
|
g();
|
|
}
|