mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Add trait obligations for where clauses when calling functions/methods
E.g. if we call `foo<T: Into<u32>>(x)`, that adds an obligation that `x: Into<u32>`, etc.
This commit is contained in:
parent
219e0e8c8d
commit
065d398701
7 changed files with 156 additions and 34 deletions
|
@ -221,6 +221,18 @@ impl Resolver {
|
|||
pub(crate) fn krate(&self) -> Option<Crate> {
|
||||
self.module().map(|t| t.0.krate())
|
||||
}
|
||||
|
||||
pub(crate) fn where_predicates_in_scope<'a>(
|
||||
&'a self,
|
||||
) -> impl Iterator<Item = &'a crate::generics::WherePredicate> + 'a {
|
||||
self.scopes
|
||||
.iter()
|
||||
.filter_map(|scope| match scope {
|
||||
Scope::GenericParams(params) => Some(params),
|
||||
_ => None,
|
||||
})
|
||||
.flat_map(|params| params.where_predicates.iter())
|
||||
}
|
||||
}
|
||||
|
||||
impl Resolver {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue