2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2015-11-23 13:57:28 -06:00
|
|
|
fn main() {
|
|
|
|
let x = X(15);
|
|
|
|
let y = x.foo();
|
|
|
|
println!("{:?}",y);
|
|
|
|
}
|
|
|
|
|
2015-12-15 03:31:58 -06:00
|
|
|
trait Foo
|
|
|
|
where for<'a> &'a Self: Bar
|
|
|
|
{
|
2015-11-23 13:57:28 -06:00
|
|
|
fn foo<'a>(&'a self) -> <&'a Self as Bar>::Output;
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Bar {
|
|
|
|
type Output;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct X(i32);
|
|
|
|
|
|
|
|
impl<'a> Bar for &'a X {
|
|
|
|
type Output = &'a i32;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Foo for X {
|
|
|
|
fn foo<'a>(&'a self) -> <&'a Self as Bar>::Output {
|
|
|
|
&self.0
|
|
|
|
}
|
|
|
|
}
|