// check-pass use std::rc::Rc; use std::sync::Arc; use std::ops::Deref; trait PointerFamily { type Pointer: Deref; fn new(value: T) -> Self::Pointer; } struct ArcFamily; impl PointerFamily for ArcFamily { type Pointer = Arc; fn new(value: T) -> Self::Pointer { Arc::new(value) } } struct RcFamily; impl PointerFamily for RcFamily { type Pointer = Rc; fn new(value: T) -> Self::Pointer { Rc::new(value) } } struct Foo { bar: P::Pointer, } fn main() {}