mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-05 05:04:24 +00:00
17 lines
225 B
Rust
17 lines
225 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);
|
|
}
|