1 // run-pass
2 // Test that we are able to infer that the type of `x` is `isize` based
3 // on the expected type from the object.
4 
5 // pretty-expanded FIXME #23616
6 
7 pub trait ToPrimitive {
to_int(&self)8     fn to_int(&self) {}
9 }
10 
11 impl ToPrimitive for isize {}
12 impl ToPrimitive for i32 {}
13 impl ToPrimitive for usize {}
14 
doit<T>(val: T, f: &dyn Fn(T))15 fn doit<T>(val: T, f: &dyn Fn(T)) { f(val) }
16 
main()17 pub fn main() {
18     doit(0, &|x /*: isize*/ | { x.to_int(); });
19 }
20