aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty')
-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#"