Also replace the associated types with iter

This commit is contained in:
Kirill Bulatov 2020-10-10 21:37:20 +03:00
parent 9a72b7bccd
commit 2bb80a4f03
2 changed files with 19 additions and 12 deletions

View file

@ -1372,7 +1372,7 @@ impl Type {
r#trait: Trait,
args: &[Type],
alias: TypeAlias,
) -> Option<Ty> {
) -> Option<Type> {
let subst = Substs::build_for_def(db, r#trait.id)
.push(self.ty.value.clone())
.fill(args.iter().map(|t| t.ty.value.clone()))
@ -1393,6 +1393,10 @@ impl Type {
Solution::Unique(SolutionVariables(subst)) => subst.value.first().cloned(),
Solution::Ambig(_) => None,
}
.map(|ty| Type {
krate: self.krate,
ty: InEnvironment { value: ty, environment: Arc::clone(&self.ty.environment) },
})
}
pub fn is_copy(&self, db: &dyn HirDatabase) -> bool {