Skip to content

Commit

Permalink
Add test for #4281
Browse files Browse the repository at this point in the history
Fixes #4281.
  • Loading branch information
flodiebold committed Jul 11, 2020
1 parent e4cb33a commit 92b7b7d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions crates/ra_hir_ty/src/tests/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,29 @@ fn test() {
);
}

#[test]
fn fn_item_fn_trait() {
check_types(
r#"
//- /main.rs
#[lang = "fn_once"]
trait FnOnce<Args> {
type Output;
}
struct S;
fn foo() -> S {}
fn takes_closure<U, F: FnOnce() -> U>(f: F) -> U { f() }
fn test() {
takes_closure(foo);
} //^^^^^^^^^^^^^^^^^^ S
"#,
);
}

#[test]
fn unselected_projection_in_trait_env_1() {
check_types(
Expand Down

0 comments on commit 92b7b7d

Please sign in to comment.