We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 850ba2f commit b5510f0Copy full SHA for b5510f0
crates/hir-ty/src/tests/simple.rs
@@ -2743,6 +2743,29 @@ impl B for Astruct {}
2743
)
2744
}
2745
2746
+#[test]
2747
+fn closures_kinds_with_predicates() {
2748
+ check_types(
2749
+ r#"
2750
+//- minicore: fn
2751
+struct A<F: FnOnce()>(F);
2752
+struct B<'a, F: FnMut()>(&'a F);
2753
+
2754
+fn f() {
2755
+ let c1 = || {};
2756
+ //^^ impl Fn()
2757
+ let a1 = A(|| {});
2758
+ let c2 = a1.0;
2759
+ //^^ impl FnOnce()
2760
+ let c3 = || {};
2761
+ //^^ impl FnMut()
2762
+ let a2 = A(c3);
2763
+ let b1 = B(&a2.0);
2764
+}
2765
+ "#,
2766
+ )
2767
2768
2769
#[test]
2770
fn capture_kinds_simple() {
2771
check_types(
0 commit comments