More trait infrastructure

- make it possible to get parent trait from method
 - add 'obligation' machinery for checking that a type implements a
   trait (and inferring facts about type variables from that)
 - handle type parameters of traits (to a certain degree)
 - improve the hacky implements check to cover enough cases to exercise the
   handling of traits with type parameters
 - basic canonicalization (will probably also be done by Chalk)
This commit is contained in:
Florian Diebold 2019-03-31 20:02:16 +02:00
parent 413c87f155
commit a1ed53a4f1
11 changed files with 333 additions and 51 deletions

View file

@ -84,7 +84,8 @@ impl ImplBlock {
}
pub fn target_trait_ref(&self, db: &impl HirDatabase) -> Option<TraitRef> {
TraitRef::from_hir(db, &self.resolver(db), &self.target_trait(db)?)
let target_ty = self.target_ty(db);
TraitRef::from_hir(db, &self.resolver(db), &self.target_trait(db)?, Some(target_ty))
}
pub fn items(&self, db: &impl DefDatabase) -> Vec<ImplItem> {