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:
Florian Diebold 2019-07-06 16:41:04 +02:00
parent 219e0e8c8d
commit 065d398701
7 changed files with 156 additions and 34 deletions

View file

@ -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 {