Get rid of manual Trace calls
This commit is contained in:
parent
f989d2f625
commit
89f3651402
6 changed files with 29 additions and 12 deletions
|
@ -1158,7 +1158,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
let (a_sig, b_sig) = self.normalize(new.span, (a_sig, b_sig));
|
let (a_sig, b_sig) = self.normalize(new.span, (a_sig, b_sig));
|
||||||
let sig = self
|
let sig = self
|
||||||
.at(cause, self.param_env)
|
.at(cause, self.param_env)
|
||||||
.trace(prev_ty, new_ty)
|
|
||||||
.lub(DefineOpaqueTypes::Yes, a_sig, b_sig)
|
.lub(DefineOpaqueTypes::Yes, a_sig, b_sig)
|
||||||
.map(|ok| self.register_infer_ok_obligations(ok))?;
|
.map(|ok| self.register_infer_ok_obligations(ok))?;
|
||||||
|
|
||||||
|
|
|
@ -156,6 +156,23 @@ impl<'a, 'tcx> At<'a, 'tcx> {
|
||||||
self.trace(expected, actual).eq(define_opaque_types, expected, actual)
|
self.trace(expected, actual).eq(define_opaque_types, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Equates `expected` and `found` while structurally relating aliases.
|
||||||
|
/// This should only be used inside of the next generation trait solver
|
||||||
|
/// when relating rigid aliases.
|
||||||
|
pub fn eq_structurally_relating_aliases<T>(
|
||||||
|
self,
|
||||||
|
expected: T,
|
||||||
|
actual: T,
|
||||||
|
) -> InferResult<'tcx, ()>
|
||||||
|
where
|
||||||
|
T: ToTrace<'tcx>,
|
||||||
|
{
|
||||||
|
self.trace(expected, actual).eq_structurally_relating_aliases(
|
||||||
|
expected,
|
||||||
|
actual,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn relate<T>(
|
pub fn relate<T>(
|
||||||
self,
|
self,
|
||||||
define_opaque_types: DefineOpaqueTypes,
|
define_opaque_types: DefineOpaqueTypes,
|
||||||
|
|
|
@ -362,7 +362,6 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
|
||||||
for (&orig, response) in iter::zip(original_values, var_values.var_values) {
|
for (&orig, response) in iter::zip(original_values, var_values.var_values) {
|
||||||
let InferOk { value: (), obligations } = infcx
|
let InferOk { value: (), obligations } = infcx
|
||||||
.at(&cause, param_env)
|
.at(&cause, param_env)
|
||||||
.trace(orig, response)
|
|
||||||
.eq_structurally_relating_aliases(orig, response)
|
.eq_structurally_relating_aliases(orig, response)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(obligations.is_empty());
|
assert!(obligations.is_empty());
|
||||||
|
|
|
@ -774,7 +774,6 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
|
||||||
let InferOk { value: (), obligations } = self
|
let InferOk { value: (), obligations } = self
|
||||||
.infcx
|
.infcx
|
||||||
.at(&ObligationCause::dummy(), param_env)
|
.at(&ObligationCause::dummy(), param_env)
|
||||||
.trace(term, ctor_term)
|
|
||||||
.eq_structurally_relating_aliases(term, ctor_term)?;
|
.eq_structurally_relating_aliases(term, ctor_term)?;
|
||||||
debug_assert!(obligations.is_empty());
|
debug_assert!(obligations.is_empty());
|
||||||
self.relate(param_env, alias, variance, rigid_ctor)
|
self.relate(param_env, alias, variance, rigid_ctor)
|
||||||
|
@ -794,11 +793,8 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
|
||||||
rhs: T,
|
rhs: T,
|
||||||
) -> Result<(), NoSolution> {
|
) -> Result<(), NoSolution> {
|
||||||
let cause = ObligationCause::dummy();
|
let cause = ObligationCause::dummy();
|
||||||
let InferOk { value: (), obligations } = self
|
let InferOk { value: (), obligations } =
|
||||||
.infcx
|
self.infcx.at(&cause, param_env).eq_structurally_relating_aliases(lhs, rhs)?;
|
||||||
.at(&cause, param_env)
|
|
||||||
.trace(lhs, rhs)
|
|
||||||
.eq_structurally_relating_aliases(lhs, rhs)?;
|
|
||||||
assert!(obligations.is_empty());
|
assert!(obligations.is_empty());
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -566,10 +566,13 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
|
||||||
{
|
{
|
||||||
if let Ok(new_obligations) = infcx
|
if let Ok(new_obligations) = infcx
|
||||||
.at(&obligation.cause, obligation.param_env)
|
.at(&obligation.cause, obligation.param_env)
|
||||||
.trace(c1, c2)
|
|
||||||
// Can define opaque types as this is only reachable with
|
// Can define opaque types as this is only reachable with
|
||||||
// `generic_const_exprs`
|
// `generic_const_exprs`
|
||||||
.eq(DefineOpaqueTypes::Yes, a.args, b.args)
|
.eq(
|
||||||
|
DefineOpaqueTypes::Yes,
|
||||||
|
ty::AliasTerm::from(a),
|
||||||
|
ty::AliasTerm::from(b),
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return ProcessResult::Changed(mk_pending(
|
return ProcessResult::Changed(mk_pending(
|
||||||
new_obligations.into_obligations(),
|
new_obligations.into_obligations(),
|
||||||
|
|
|
@ -910,10 +910,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
if let Ok(InferOk { obligations, value: () }) = self
|
if let Ok(InferOk { obligations, value: () }) = self
|
||||||
.infcx
|
.infcx
|
||||||
.at(&obligation.cause, obligation.param_env)
|
.at(&obligation.cause, obligation.param_env)
|
||||||
.trace(c1, c2)
|
|
||||||
// Can define opaque types as this is only reachable with
|
// Can define opaque types as this is only reachable with
|
||||||
// `generic_const_exprs`
|
// `generic_const_exprs`
|
||||||
.eq(DefineOpaqueTypes::Yes, a.args, b.args)
|
.eq(
|
||||||
|
DefineOpaqueTypes::Yes,
|
||||||
|
ty::AliasTerm::from(a),
|
||||||
|
ty::AliasTerm::from(b),
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return self.evaluate_predicates_recursively(
|
return self.evaluate_predicates_recursively(
|
||||||
previous_stack,
|
previous_stack,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue