Handle cycles in impl types better

- impl Trait<Self> for S is allowed
 - impl Trait for S<Self> is an invalid cycle, but we can add cycle recovery for
   it in Salsa now
This commit is contained in:
Florian Diebold
2019-11-30 12:35:37 +01:00
parent 7cecd0f331
commit cf6809645e
8 changed files with 82 additions and 53 deletions

View File

@@ -486,21 +486,6 @@ impl TypeWalk for TraitRef {
}
}
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum ImplTy {
Inherent(Ty),
TraitRef(TraitRef),
}
impl ImplTy {
pub(crate) fn self_type(&self) -> &Ty {
match self {
ImplTy::Inherent(it) => it,
ImplTy::TraitRef(tr) => &tr.substs[0],
}
}
}
/// Like `generics::WherePredicate`, but with resolved types: A condition on the
/// parameters of a generic item.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]