Skip to content

Commit c6f53aa

Browse files
committed
Add test for #4281
Fixes #4281.
1 parent 7e9c4d5 commit c6f53aa

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

crates/ra_hir_ty/src/tests/traits.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,6 +1991,29 @@ fn test() {
19911991
);
19921992
}
19931993

1994+
#[test]
1995+
fn fn_item_fn_trait() {
1996+
check_types(
1997+
r#"
1998+
//- /main.rs
1999+
#[lang = "fn_once"]
2000+
trait FnOnce<Args> {
2001+
type Output;
2002+
}
2003+
2004+
struct S;
2005+
2006+
fn foo() -> S {}
2007+
2008+
fn takes_closure<U, F: FnOnce() -> U>(f: F) -> U { f() }
2009+
2010+
fn test() {
2011+
takes_closure(foo);
2012+
} //^^^^^^^^^^^^^^^^^^ S
2013+
"#,
2014+
);
2015+
}
2016+
19942017
#[test]
19952018
fn unselected_projection_in_trait_env_1() {
19962019
check_types(

0 commit comments

Comments
 (0)