rust/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-74261.rs

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

31 lines
396 B
Rust
Raw Normal View History

// check-pass
use std::marker::PhantomData;
trait A<'a> {
type B;
fn b(self) -> Self::B;
}
struct T;
struct S<'a>(PhantomData<&'a ()>);
impl<'a> A<'a> for T {
type B = S<'a>;
fn b(self) -> Self::B {
S(PhantomData)
}
}
fn s<TT, F>(t: TT, f: F)
where
TT: for<'a> A<'a>,
F: for<'a> FnOnce(<TT as A<'a>>::B)
{
f(t.b());
}
fn main() {
s(T, |_| {});
}