diff options
Diffstat (limited to 'crates/ide/src/syntax_highlighting/tests.rs')
-rw-r--r-- | crates/ide/src/syntax_highlighting/tests.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs index 126363b8b..da20c300e 100644 --- a/crates/ide/src/syntax_highlighting/tests.rs +++ b/crates/ide/src/syntax_highlighting/tests.rs | |||
@@ -18,6 +18,17 @@ pub mod marker { | |||
18 | pub trait Copy {} | 18 | pub trait Copy {} |
19 | } | 19 | } |
20 | 20 | ||
21 | pub mod ops { | ||
22 | #[lang = "fn_once"] | ||
23 | pub trait FnOnce<Args> {} | ||
24 | |||
25 | #[lang = "fn_mut"] | ||
26 | pub trait FnMut<Args>: FnOnce<Args> {} | ||
27 | |||
28 | #[lang = "fn"] | ||
29 | pub trait Fn<Args>: FnMut<Args> {} | ||
30 | } | ||
31 | |||
21 | 32 | ||
22 | struct Foo { | 33 | struct Foo { |
23 | pub x: i32, | 34 | pub x: i32, |
@@ -73,6 +84,11 @@ fn foo<'a, T>() -> T { | |||
73 | foo::<'a, i32>() | 84 | foo::<'a, i32>() |
74 | } | 85 | } |
75 | 86 | ||
87 | use ops::Fn; | ||
88 | fn baz<F: Fn() -> ()>(f: F) { | ||
89 | f() | ||
90 | } | ||
91 | |||
76 | macro_rules! def_fn { | 92 | macro_rules! def_fn { |
77 | ($($tt:tt)*) => {$($tt)*} | 93 | ($($tt:tt)*) => {$($tt)*} |
78 | } | 94 | } |
@@ -131,6 +147,9 @@ fn main() { | |||
131 | copy.quop(); | 147 | copy.quop(); |
132 | copy.qux(); | 148 | copy.qux(); |
133 | copy.baz(copy); | 149 | copy.baz(copy); |
150 | |||
151 | let a = |x| x; | ||
152 | let bar = Foo::baz; | ||
134 | } | 153 | } |
135 | 154 | ||
136 | enum Option<T> { | 155 | enum Option<T> { |