aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-07-11 18:55:11 +0100
committerFlorian Diebold <[email protected]>2020-07-12 19:20:31 +0100
commitc6f53aaaa4d640cff809bba11af80051f29c6be5 (patch)
tree30dc40345f98ceb6eaf7ee286d390e56d2cad506 /crates
parent7e9c4d58f189d4ac3c390a6ea345f2578dd5f661 (diff)
Add test for #4281
Fixes #4281.
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir_ty/src/tests/traits.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs
index 511ed8fe3..05a56215f 100644
--- a/crates/ra_hir_ty/src/tests/traits.rs
+++ b/crates/ra_hir_ty/src/tests/traits.rs
@@ -1992,6 +1992,29 @@ fn test() {
1992} 1992}
1993 1993
1994#[test] 1994#[test]
1995fn fn_item_fn_trait() {
1996 check_types(
1997 r#"
1998//- /main.rs
1999#[lang = "fn_once"]
2000trait FnOnce<Args> {
2001 type Output;
2002}
2003
2004struct S;
2005
2006fn foo() -> S {}
2007
2008fn takes_closure<U, F: FnOnce() -> U>(f: F) -> U { f() }
2009
2010fn test() {
2011 takes_closure(foo);
2012} //^^^^^^^^^^^^^^^^^^ S
2013"#,
2014 );
2015}
2016
2017#[test]
1995fn unselected_projection_in_trait_env_1() { 2018fn unselected_projection_in_trait_env_1() {
1996 check_types( 2019 check_types(
1997 r#" 2020 r#"