2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(unused_variables)]
|
2017-12-02 13:15:03 -06:00
|
|
|
pub trait Parameters { type SelfRef; }
|
2015-10-24 16:29:13 -05:00
|
|
|
|
|
|
|
struct RP<'a> { _marker: std::marker::PhantomData<&'a ()> }
|
|
|
|
struct BP;
|
|
|
|
|
2017-12-02 13:15:03 -06:00
|
|
|
impl<'a> Parameters for RP<'a> { type SelfRef = &'a X<RP<'a>>; }
|
|
|
|
impl Parameters for BP { type SelfRef = Box<X<BP>>; }
|
2015-10-24 16:29:13 -05:00
|
|
|
|
|
|
|
pub struct Y;
|
2017-12-02 13:15:03 -06:00
|
|
|
pub enum X<P: Parameters> {
|
2015-10-24 16:29:13 -05: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);
|
|
|
|
}
|