rust/tests/rustdoc/auxiliary/extern-impl-trait.rs
2023-01-11 09:32:08 +00:00

28 lines
389 B
Rust

pub trait Foo {
type Associated;
}
pub struct X;
pub struct Y;
impl Foo for X {
type Associated = ();
}
impl Foo for Y {
type Associated = ();
}
impl X {
pub fn returns_sized<'a>(&'a self) -> impl Foo<Associated=()> + 'a {
X
}
}
impl Y {
pub fn returns_unsized<'a>(&'a self) -> Box<impl ?Sized + Foo<Associated=()> + 'a> {
Box::new(X)
}
}