Minor refactorings
This commit is contained in:
parent
2feabc4dc4
commit
c6aea8c2f9
@ -803,17 +803,17 @@ pub(crate) fn adt_variance_query(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns instantiated predicates.
|
||||||
pub(super) fn convert_where_clauses(
|
pub(super) fn convert_where_clauses(
|
||||||
db: &dyn HirDatabase,
|
db: &dyn HirDatabase,
|
||||||
def: GenericDefId,
|
def: GenericDefId,
|
||||||
substs: &Substitution,
|
substs: &Substitution,
|
||||||
) -> Vec<chalk_ir::QuantifiedWhereClause<Interner>> {
|
) -> Vec<chalk_ir::QuantifiedWhereClause<Interner>> {
|
||||||
let generic_predicates = db.generic_predicates(def);
|
db.generic_predicates(def)
|
||||||
let mut result = Vec::with_capacity(generic_predicates.len());
|
.iter()
|
||||||
for pred in generic_predicates.iter() {
|
.cloned()
|
||||||
result.push(pred.clone().substitute(Interner, substs));
|
.map(|pred| pred.substitute(Interner, substs))
|
||||||
}
|
.collect()
|
||||||
result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn generic_predicate_to_inline_bound(
|
pub(super) fn generic_predicate_to_inline_bound(
|
||||||
|
@ -742,9 +742,8 @@ fn find_matching_impl(
|
|||||||
actual_trait_ref: TraitRef,
|
actual_trait_ref: TraitRef,
|
||||||
) -> Option<(Arc<ImplData>, Substitution)> {
|
) -> Option<(Arc<ImplData>, Substitution)> {
|
||||||
let db = table.db;
|
let db = table.db;
|
||||||
loop {
|
impls.find_map(|impl_| {
|
||||||
let impl_ = impls.next()?;
|
table.run_in_snapshot(|table| {
|
||||||
let r = table.run_in_snapshot(|table| {
|
|
||||||
let impl_data = db.impl_data(impl_);
|
let impl_data = db.impl_data(impl_);
|
||||||
let impl_substs =
|
let impl_substs =
|
||||||
TyBuilder::subst_for_def(db, impl_, None).fill_with_inference_vars(table).build();
|
TyBuilder::subst_for_def(db, impl_, None).fill_with_inference_vars(table).build();
|
||||||
@ -762,11 +761,8 @@ fn find_matching_impl(
|
|||||||
.map(|b| b.cast(Interner));
|
.map(|b| b.cast(Interner));
|
||||||
let goal = crate::Goal::all(Interner, wcs);
|
let goal = crate::Goal::all(Interner, wcs);
|
||||||
table.try_obligation(goal).map(|_| (impl_data, table.resolve_completely(impl_substs)))
|
table.try_obligation(goal).map(|_| (impl_data, table.resolve_completely(impl_substs)))
|
||||||
});
|
})
|
||||||
if r.is_some() {
|
})
|
||||||
break r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_inherent_impl_coherent(
|
fn is_inherent_impl_coherent(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user