rust/src/test/ui/regions/regions-escape-via-trait-or-not.rs
2018-12-25 21:08:33 -07:00

23 lines
315 B
Rust

#![allow(dead_code)]
trait Deref {
fn get(self) -> isize;
}
impl<'a> Deref for &'a isize {
fn get(self) -> isize {
*self
}
}
fn with<R:Deref, F>(f: F) -> isize where F: FnOnce(&isize) -> R {
f(&3).get()
}
fn return_it() -> isize {
with(|o| o) //~ ERROR cannot infer
}
fn main() {
}