mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
16 lines
226 B
Rust
16 lines
226 B
Rust
//@ run-pass
|
|
trait ToRef<'a> {
|
|
type Ref: 'a;
|
|
}
|
|
|
|
impl<'a, U: 'a> ToRef<'a> for U {
|
|
type Ref = &'a U;
|
|
}
|
|
|
|
fn example<'a, T>(value: &'a T) -> (<T as ToRef<'a>>::Ref, u32) {
|
|
(value, 0)
|
|
}
|
|
|
|
fn main() {
|
|
example(&0);
|
|
}
|