diff options
author | Florian Diebold <[email protected]> | 2019-05-07 17:53:16 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-05-11 15:21:20 +0100 |
commit | d6dc75f9f22b73faf8c526be69ca43e52d6db1bf (patch) | |
tree | f17b35ab78b5dc123e55a69f065dc47d08ef3ff8 /crates/ra_syntax/src | |
parent | 7744cd41e2ad79c1b36d3d9fccd3bc0dbfd9e2d9 (diff) |
Handle auto traits & negative impls
We don't pass field types to Chalk yet though, so the auto trait inference won't
be correct.
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ast/extensions.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index 9cbd2c6b8..f3466c585 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs | |||
@@ -170,6 +170,10 @@ impl ast::ImplBlock { | |||
170 | let second = types.next(); | 170 | let second = types.next(); |
171 | (first, second) | 171 | (first, second) |
172 | } | 172 | } |
173 | |||
174 | pub fn is_negative(&self) -> bool { | ||
175 | self.syntax().children_with_tokens().any(|t| t.kind() == EXCL) | ||
176 | } | ||
173 | } | 177 | } |
174 | 178 | ||
175 | #[derive(Debug, Clone, PartialEq, Eq)] | 179 | #[derive(Debug, Clone, PartialEq, Eq)] |
@@ -348,3 +352,9 @@ impl ast::WherePred { | |||
348 | .find(|it| it.kind() == LIFETIME) | 352 | .find(|it| it.kind() == LIFETIME) |
349 | } | 353 | } |
350 | } | 354 | } |
355 | |||
356 | impl ast::TraitDef { | ||
357 | pub fn is_auto(&self) -> bool { | ||
358 | self.syntax().children_with_tokens().any(|t| t.kind() == AUTO_KW) | ||
359 | } | ||
360 | } | ||