We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3afb7d6 commit b27c22dCopy full SHA for b27c22d
tests/ui/traits/fn-pointer/hrtb-assoc-fn-traits-28994.rs
@@ -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