Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (18 sloc) 431 Bytes
// run-pass
// Test that we are able to infer that the type of `x` is `isize` based
// on the expected type from the object.
// pretty-expanded FIXME #23616
pub trait ToPrimitive {
fn to_int(&self) {}
}
impl ToPrimitive for isize {}
impl ToPrimitive for i32 {}
impl ToPrimitive for usize {}
fn doit<T,F>(val: T, f: &F)
where F : Fn(&T)
{
f(&val)
}
pub fn main() {
doit(0, &|x /*: isize*/ | { x.to_int(); });
}
You can’t perform that action at this time.