Skip to content

Commit b27c22d

Browse files
committed
Add test for issue 28994
1 parent 3afb7d6 commit b27c22d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//@ check-pass
2+
//! Tests that a HRTB + FnOnce bound involving an associated type don't prevent
3+
//! a function pointer from implementing `Fn` traits.
4+
//! Test for <https://github.com/rust-lang/rust/issues/28994>
5+
6+
trait LifetimeToType<'a> {
7+
type Out;
8+
}
9+
10+
impl<'a> LifetimeToType<'a> for () {
11+
type Out = &'a ();
12+
}
13+
14+
fn id<'a>(val: &'a ()) -> <() as LifetimeToType<'a>>::Out {
15+
val
16+
}
17+
18+
fn assert_fn<F: for<'a> FnOnce(&'a ()) -> <() as LifetimeToType<'a>>::Out>(_func: F) { }
19+
20+
fn main() {
21+
assert_fn(id);
22+
}

0 commit comments

Comments
 (0)