diff options
Diffstat (limited to 'crates')
-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#" |