mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
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:
parent
7744cd41e2
commit
d6dc75f9f2
5 changed files with 48 additions and 8 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue