File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -2886,6 +2886,43 @@ fn f() {
28862886 )
28872887}
28882888
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+
28892926#[ test]
28902927fn derive_macro_should_work_for_associated_type ( ) {
28912928 check_types (
You can’t perform that action at this time.
0 commit comments