diff options
Diffstat (limited to 'tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-70120.rs')
-rw-r--r-- | tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-70120.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-70120.rs b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-70120.rs new file mode 100644 index 000000000..3ced40230 --- /dev/null +++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-70120.rs @@ -0,0 +1,31 @@ +// check-pass + +pub trait MyTrait<'a> { + type Output: 'a; + fn gimme_value(&self) -> Self::Output; +} + +pub struct MyStruct; + +impl<'a> MyTrait<'a> for MyStruct { + type Output = &'a usize; + fn gimme_value(&self) -> Self::Output { + unimplemented!() + } +} + +fn meow<T, F>(t: T, f: F) +where + T: for<'any> MyTrait<'any>, + F: for<'any2> Fn(<T as MyTrait<'any2>>::Output), +{ + let v = t.gimme_value(); + f(v); +} + +fn main() { + let struc = MyStruct; + meow(struc, |foo| { + println!("{:?}", foo); + }) +} |