Add test for #4281

Fixes #4281.
This commit is contained in:
Florian Diebold 2020-07-11 19:55:11 +02:00
parent 7e9c4d58f1
commit c6f53aaaa4

View file

@ -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(