Handle auto traits & negative impls

We don't pass field types to Chalk yet though, so the auto trait inference won't
be correct.
This commit is contained in:
Florian Diebold 2019-05-07 18:53:16 +02:00
parent 7744cd41e2
commit d6dc75f9f2
5 changed files with 48 additions and 8 deletions

View file

@ -170,6 +170,10 @@ impl ast::ImplBlock {
let second = types.next();
(first, second)
}
pub fn is_negative(&self) -> bool {
self.syntax().children_with_tokens().any(|t| t.kind() == EXCL)
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
@ -348,3 +352,9 @@ impl ast::WherePred {
.find(|it| it.kind() == LIFETIME)
}
}
impl ast::TraitDef {
pub fn is_auto(&self) -> bool {
self.syntax().children_with_tokens().any(|t| t.kind() == AUTO_KW)
}
}