2024-02-17 04:02:50 +08:00
|
|
|
//@ run-pass
|
2018-09-26 05:51:35 +08:00
|
|
|
#![allow(unused_variables)]
|
2017-12-03 03:15:03 +08:00
|
|
|
pub trait Parameters { type SelfRef; }
|
2015-10-25 05:29:13 +08:00
|
|
|
|
|
|
|
struct RP<'a> { _marker: std::marker::PhantomData<&'a ()> }
|
|
|
|
struct BP;
|
|
|
|
|
2017-12-03 03:15:03 +08:00
|
|
|
impl<'a> Parameters for RP<'a> { type SelfRef = &'a X<RP<'a>>; }
|
|
|
|
impl Parameters for BP { type SelfRef = Box<X<BP>>; }
|
2015-10-25 05:29:13 +08:00
|
|
|
|
|
|
|
pub struct Y;
|
2017-12-03 03:15:03 +08:00
|
|
|
pub enum X<P: Parameters> {
|
2015-10-25 05:29:13 +08:00
|
|
|
Nothing,
|
|
|
|
SameAgain(P::SelfRef, Y)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let bnil: Box<X<BP>> = Box::new(X::Nothing);
|
|
|
|
let bx: Box<X<BP>> = Box::new(X::SameAgain(bnil, Y));
|
|
|
|
let rnil: X<RP> = X::Nothing;
|
|
|
|
let rx: X<RP> = X::SameAgain(&rnil, Y);
|
|
|
|
}
|