review + some small stuff
This commit is contained in:
parent
2186847f28
commit
3fab7f7c13
7 changed files with 52 additions and 14 deletions
|
@ -11,7 +11,7 @@ use crate::solve::EvalCtxt;
|
|||
//
|
||||
// For types with an "existential" binder, i.e. generator witnesses, we also
|
||||
// instantiate the binder with placeholders eagerly.
|
||||
pub(crate) fn instantiate_constituent_tys_for_auto_trait<'tcx>(
|
||||
pub(in crate::solve) fn instantiate_constituent_tys_for_auto_trait<'tcx>(
|
||||
ecx: &EvalCtxt<'_, 'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
) -> Result<Vec<Ty<'tcx>>, NoSolution> {
|
||||
|
@ -87,7 +87,7 @@ pub(crate) fn instantiate_constituent_tys_for_auto_trait<'tcx>(
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn replace_erased_lifetimes_with_bound_vars<'tcx>(
|
||||
pub(in crate::solve) fn replace_erased_lifetimes_with_bound_vars<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
) -> ty::Binder<'tcx, Ty<'tcx>> {
|
||||
|
@ -108,7 +108,7 @@ pub(crate) fn replace_erased_lifetimes_with_bound_vars<'tcx>(
|
|||
ty::Binder::bind_with_vars(ty, bound_vars)
|
||||
}
|
||||
|
||||
pub(crate) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
|
||||
pub(in crate::solve) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
|
||||
ecx: &EvalCtxt<'_, 'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
) -> Result<Vec<Ty<'tcx>>, NoSolution> {
|
||||
|
@ -158,7 +158,7 @@ pub(crate) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn instantiate_constituent_tys_for_copy_clone_trait<'tcx>(
|
||||
pub(in crate::solve) fn instantiate_constituent_tys_for_copy_clone_trait<'tcx>(
|
||||
ecx: &EvalCtxt<'_, 'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
) -> Result<Vec<Ty<'tcx>>, NoSolution> {
|
||||
|
@ -224,7 +224,7 @@ pub(crate) fn instantiate_constituent_tys_for_copy_clone_trait<'tcx>(
|
|||
}
|
||||
|
||||
// Returns a binder of the tupled inputs types and output type from a builtin callable type.
|
||||
pub(crate) fn extract_tupled_inputs_and_output_from_callable<'tcx>(
|
||||
pub(in crate::solve) fn extract_tupled_inputs_and_output_from_callable<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
self_ty: Ty<'tcx>,
|
||||
goal_kind: ty::ClosureKind,
|
||||
|
@ -337,7 +337,13 @@ pub(crate) fn extract_tupled_inputs_and_output_from_callable<'tcx>(
|
|||
/// additional step of eagerly folding the associated types in the where
|
||||
/// clauses of the impl. In this example, that means replacing
|
||||
/// `<Self as Foo>::Bar` with `Ty` in the first impl.
|
||||
pub(crate) fn predicates_for_object_candidate<'tcx>(
|
||||
///
|
||||
// FIXME: This is only necessary as `<Self as Trait>::Assoc: ItemBound`
|
||||
// bounds in impls are trivially proven using the item bound candidates.
|
||||
// This is unsound in general and once that is fixed, we don't need to
|
||||
// normalize eagerly here. See https://github.com/lcnr/solver-woes/issues/9
|
||||
// for more details.
|
||||
pub(in crate::solve) fn predicates_for_object_candidate<'tcx>(
|
||||
ecx: &EvalCtxt<'_, 'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
trait_ref: ty::TraitRef<'tcx>,
|
||||
|
|
|
@ -357,7 +357,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
|
|||
// deal with `has_changed` in the next iteration.
|
||||
new_goals.normalizes_to_hack_goal =
|
||||
Some(this.resolve_vars_if_possible(goal));
|
||||
has_changed = has_changed.map_err(|c| c.unify_and(certainty));
|
||||
has_changed = has_changed.map_err(|c| c.unify_with(certainty));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
|
|||
Certainty::Yes => {}
|
||||
Certainty::Maybe(_) => {
|
||||
new_goals.goals.push(goal);
|
||||
has_changed = has_changed.map_err(|c| c.unify_and(certainty));
|
||||
has_changed = has_changed.map_err(|c| c.unify_with(certainty));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||
certainty: Certainty,
|
||||
) -> QueryResult<'tcx> {
|
||||
let goals_certainty = self.try_evaluate_added_goals()?;
|
||||
let certainty = certainty.unify_and(goals_certainty);
|
||||
let certainty = certainty.unify_with(goals_certainty);
|
||||
|
||||
let external_constraints = self.compute_external_query_constraints()?;
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||
return Err(NoSolution);
|
||||
}
|
||||
let certainty = responses.iter().fold(Certainty::AMBIGUOUS, |certainty, response| {
|
||||
certainty.unify_and(response.value.certainty)
|
||||
certainty.unify_with(response.value.certainty)
|
||||
});
|
||||
|
||||
let response = self.evaluate_added_goals_and_make_canonical_response(certainty);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue