3 #![allow(unused_imports)]
4 // Test a regression found when building compiler. The `produce()`
5 // error type `T` winds up getting unified with result of `x.parse()`;
6 // the type of the closure given to `unwrap_or_else` needs to be
7 // inferred to `usize`.
9 use std::num::ParseIntError;
11 fn produce<T>() -> Result<&'static str, T> {
16 let x: usize = produce()
17 .and_then(|x| x.parse())
18 .unwrap_or_else(|_| panic!());