blob: b322b752a156738a349bb866f9ef1a837fdb678c [file] [log] [blame]
#![allow(incomplete_features)]
#![feature(generic_associated_types)]
// check-pass
use std::rc::Rc;
use std::sync::Arc;
use std::ops::Deref;
trait PointerFamily {
type Pointer<T>: Deref<Target = T>;
fn new<T>(value: T) -> Self::Pointer<T>;
}
struct ArcFamily;
impl PointerFamily for ArcFamily {
type Pointer<T> = Arc<T>;
fn new<T>(value: T) -> Self::Pointer<T> {
Arc::new(value)
}
}
struct RcFamily;
impl PointerFamily for RcFamily {
type Pointer<T> = Rc<T>;
fn new<T>(value: T) -> Self::Pointer<T> {
Rc::new(value)
}
}
struct Foo<P: PointerFamily> {
bar: P::Pointer<String>,
}
fn main() {}