Skip to content

Commit 89f3651

Browse files
Get rid of manual Trace calls
1 parent f989d2f commit 89f3651

File tree

6 files changed

+29
-12
lines changed

6 files changed

+29
-12
lines changed

compiler/rustc_hir_typeck/src/coercion.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11581158
let (a_sig, b_sig) = self.normalize(new.span, (a_sig, b_sig));
11591159
let sig = self
11601160
.at(cause, self.param_env)
1161-
.trace(prev_ty, new_ty)
11621161
.lub(DefineOpaqueTypes::Yes, a_sig, b_sig)
11631162
.map(|ok| self.register_infer_ok_obligations(ok))?;
11641163

compiler/rustc_infer/src/infer/at.rs

+17
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,23 @@ impl<'a, 'tcx> At<'a, 'tcx> {
156156
self.trace(expected, actual).eq(define_opaque_types, expected, actual)
157157
}
158158

159+
/// Equates `expected` and `found` while structurally relating aliases.
160+
/// This should only be used inside of the next generation trait solver
161+
/// when relating rigid aliases.
162+
pub fn eq_structurally_relating_aliases<T>(
163+
self,
164+
expected: T,
165+
actual: T,
166+
) -> InferResult<'tcx, ()>
167+
where
168+
T: ToTrace<'tcx>,
169+
{
170+
self.trace(expected, actual).eq_structurally_relating_aliases(
171+
expected,
172+
actual,
173+
)
174+
}
175+
159176
pub fn relate<T>(
160177
self,
161178
define_opaque_types: DefineOpaqueTypes,

compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs

-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
362362
for (&orig, response) in iter::zip(original_values, var_values.var_values) {
363363
let InferOk { value: (), obligations } = infcx
364364
.at(&cause, param_env)
365-
.trace(orig, response)
366365
.eq_structurally_relating_aliases(orig, response)
367366
.unwrap();
368367
assert!(obligations.is_empty());

compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,6 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
774774
let InferOk { value: (), obligations } = self
775775
.infcx
776776
.at(&ObligationCause::dummy(), param_env)
777-
.trace(term, ctor_term)
778777
.eq_structurally_relating_aliases(term, ctor_term)?;
779778
debug_assert!(obligations.is_empty());
780779
self.relate(param_env, alias, variance, rigid_ctor)
@@ -794,11 +793,8 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
794793
rhs: T,
795794
) -> Result<(), NoSolution> {
796795
let cause = ObligationCause::dummy();
797-
let InferOk { value: (), obligations } = self
798-
.infcx
799-
.at(&cause, param_env)
800-
.trace(lhs, rhs)
801-
.eq_structurally_relating_aliases(lhs, rhs)?;
796+
let InferOk { value: (), obligations } =
797+
self.infcx.at(&cause, param_env).eq_structurally_relating_aliases(lhs, rhs)?;
802798
assert!(obligations.is_empty());
803799
Ok(())
804800
}

compiler/rustc_trait_selection/src/traits/fulfill.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -566,10 +566,13 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
566566
{
567567
if let Ok(new_obligations) = infcx
568568
.at(&obligation.cause, obligation.param_env)
569-
.trace(c1, c2)
570569
// Can define opaque types as this is only reachable with
571570
// `generic_const_exprs`
572-
.eq(DefineOpaqueTypes::Yes, a.args, b.args)
571+
.eq(
572+
DefineOpaqueTypes::Yes,
573+
ty::AliasTerm::from(a),
574+
ty::AliasTerm::from(b),
575+
)
573576
{
574577
return ProcessResult::Changed(mk_pending(
575578
new_obligations.into_obligations(),

compiler/rustc_trait_selection/src/traits/select/mod.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -910,10 +910,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
910910
if let Ok(InferOk { obligations, value: () }) = self
911911
.infcx
912912
.at(&obligation.cause, obligation.param_env)
913-
.trace(c1, c2)
914913
// Can define opaque types as this is only reachable with
915914
// `generic_const_exprs`
916-
.eq(DefineOpaqueTypes::Yes, a.args, b.args)
915+
.eq(
916+
DefineOpaqueTypes::Yes,
917+
ty::AliasTerm::from(a),
918+
ty::AliasTerm::from(b),
919+
)
917920
{
918921
return self.evaluate_predicates_recursively(
919922
previous_stack,

0 commit comments

Comments
 (0)