2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2015-07-06 21:38:08 +03:00
|
|
|
trait Foo<'a> {
|
|
|
|
fn bar<'b>(&self, x: &'b u8) -> u8 where 'a: 'b { *x+7 }
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct FooBar;
|
|
|
|
impl Foo<'static> for FooBar {}
|
2019-05-28 14:47:21 -04:00
|
|
|
fn test(foobar: FooBar) -> Box<dyn Foo<'static>> {
|
2015-07-06 21:38:08 +03:00
|
|
|
Box::new(foobar)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_eq!(test(FooBar).bar(&4), 11);
|
|
|
|
}
|