File tree 1 file changed +37
-0
lines changed
1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -2886,6 +2886,43 @@ fn f() {
2886
2886
)
2887
2887
}
2888
2888
2889
+ #[ test]
2890
+ fn closure_kind_with_predicates ( ) {
2891
+ check_types (
2892
+ r#"
2893
+ //- minicore: fn
2894
+ #![feature(unboxed_closures)]
2895
+
2896
+ struct X<T: FnOnce()>(T);
2897
+
2898
+ fn f1() -> impl FnOnce() {
2899
+ || {}
2900
+ // ^^^^^ impl FnOnce()
2901
+ }
2902
+
2903
+ fn f2(c: impl FnOnce<(), Output = i32>) {}
2904
+
2905
+ fn test {
2906
+ let x1 = X(|| {});
2907
+ let c1 = x1.0;
2908
+ // ^^ impl FnOnce()
2909
+
2910
+ let c2 = || {};
2911
+ // ^^ impl Fn()
2912
+ let x2 = X(c2);
2913
+ let c3 = x2.0
2914
+ // ^^ impl Fn()
2915
+
2916
+ let c4 = f1();
2917
+ // ^^ impl FnOnce() + ?Sized
2918
+
2919
+ f2(|| { 0 });
2920
+ // ^^^^^^^^ impl FnOnce() -> i32
2921
+ }
2922
+ "# ,
2923
+ )
2924
+ }
2925
+
2889
2926
#[ test]
2890
2927
fn derive_macro_should_work_for_associated_type ( ) {
2891
2928
check_types (
You can’t perform that action at this time.
0 commit comments