diff options
author | Florian Diebold <[email protected]> | 2020-07-11 18:55:11 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2020-07-12 19:20:31 +0100 |
commit | c6f53aaaa4d640cff809bba11af80051f29c6be5 (patch) | |
tree | 30dc40345f98ceb6eaf7ee286d390e56d2cad506 /crates/ra_hir_ty/src/tests | |
parent | 7e9c4d58f189d4ac3c390a6ea345f2578dd5f661 (diff) |
Add test for #4281
Fixes #4281.
Diffstat (limited to 'crates/ra_hir_ty/src/tests')
-rw-r--r-- | crates/ra_hir_ty/src/tests/traits.rs | 23 |
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] |
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 | |||
2017 | #[test] | ||
1995 | fn unselected_projection_in_trait_env_1() { | 2018 | fn unselected_projection_in_trait_env_1() { |
1996 | check_types( | 2019 | check_types( |
1997 | r#" | 2020 | r#" |