rust/tests/rustdoc/auxiliary/extern-impl-trait.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
389 B
Rust
Raw Normal View History

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)
}
}