Skip to content

Commit b5510f0

Browse files
committed
Add a new failing test
1 parent 850ba2f commit b5510f0

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

crates/hir-ty/src/tests/simple.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2743,6 +2743,29 @@ impl B for Astruct {}
27432743
)
27442744
}
27452745

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+
27462769
#[test]
27472770
fn capture_kinds_simple() {
27482771
check_types(

0 commit comments

Comments
 (0)