diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs index 511ed8fe328e..05a56215f498 100644 --- a/crates/ra_hir_ty/src/tests/traits.rs +++ b/crates/ra_hir_ty/src/tests/traits.rs @@ -1991,6 +1991,29 @@ fn test() { ); } +#[test] +fn fn_item_fn_trait() { + check_types( + r#" +//- /main.rs +#[lang = "fn_once"] +trait FnOnce { + type Output; +} + +struct S; + +fn foo() -> S {} + +fn takes_closure U>(f: F) -> U { f() } + +fn test() { + takes_closure(foo); +} //^^^^^^^^^^^^^^^^^^ S +"#, + ); +} + #[test] fn unselected_projection_in_trait_env_1() { check_types(