diff options
| author | Michael Goulet <michael@errs.io> | 2024-05-28 11:38:58 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-05-28 11:38:58 -0400 |
| commit | 89f3651402d825d46d5aa974839b82ec0b737fe8 (patch) | |
| tree | cb51744986a94bab99f3ac10fa2a9dc23ef8f8ba /compiler | |
| parent | f989d2f62500df1696eb797d8800a705293b43b9 (diff) | |
| download | rust-89f3651402d825d46d5aa974839b82ec0b737fe8.tar.gz rust-89f3651402d825d46d5aa974839b82ec0b737fe8.zip | |
Get rid of manual Trace calls
Diffstat (limited to 'compiler')
6 files changed, 29 insertions, 12 deletions
diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs index ebdc558282a..93726ce2b3e 100644 --- a/compiler/rustc_hir_typeck/src/coercion.rs +++ b/compiler/rustc_hir_typeck/src/coercion.rs @@ -1158,7 +1158,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let (a_sig, b_sig) = self.normalize(new.span, (a_sig, b_sig)); let sig = self .at(cause, self.param_env) - .trace(prev_ty, new_ty) .lub(DefineOpaqueTypes::Yes, a_sig, b_sig) .map(|ok| self.register_infer_ok_obligations(ok))?; diff --git a/compiler/rustc_infer/src/infer/at.rs b/compiler/rustc_infer/src/infer/at.rs index 16057b6ad9d..aa37aaf22eb 100644 --- a/compiler/rustc_infer/src/infer/at.rs +++ b/compiler/rustc_infer/src/infer/at.rs @@ -156,6 +156,23 @@ impl<'a, 'tcx> At<'a, 'tcx> { 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>( self, define_opaque_types: DefineOpaqueTypes, diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs index f6ec6549084..bc248754f16 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs @@ -362,7 +362,6 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> { for (&orig, response) in iter::zip(original_values, var_values.var_values) { let InferOk { value: (), obligations } = infcx .at(&cause, param_env) - .trace(orig, response) .eq_structurally_relating_aliases(orig, response) .unwrap(); assert!(obligations.is_empty()); diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs index 4cf0af94811..9ae0809e96e 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs @@ -774,7 +774,6 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> { let InferOk { value: (), obligations } = self .infcx .at(&ObligationCause::dummy(), param_env) - .trace(term, ctor_term) .eq_structurally_relating_aliases(term, ctor_term)?; debug_assert!(obligations.is_empty()); self.relate(param_env, alias, variance, rigid_ctor) @@ -794,11 +793,8 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> { rhs: T, ) -> Result<(), NoSolution> { let cause = ObligationCause::dummy(); - let InferOk { value: (), obligations } = self - .infcx - .at(&cause, param_env) - .trace(lhs, rhs) - .eq_structurally_relating_aliases(lhs, rhs)?; + let InferOk { value: (), obligations } = + self.infcx.at(&cause, param_env).eq_structurally_relating_aliases(lhs, rhs)?; assert!(obligations.is_empty()); Ok(()) } diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs index 07fcf109fda..629f6f394af 100644 --- a/compiler/rustc_trait_selection/src/traits/fulfill.rs +++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs @@ -566,10 +566,13 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> { { if let Ok(new_obligations) = infcx .at(&obligation.cause, obligation.param_env) - .trace(c1, c2) // Can define opaque types as this is only reachable with // `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( new_obligations.into_obligations(), diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index 696b1c15115..7aec4e1987e 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -910,10 +910,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { if let Ok(InferOk { obligations, value: () }) = self .infcx .at(&obligation.cause, obligation.param_env) - .trace(c1, c2) // Can define opaque types as this is only reachable with // `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( previous_stack, |
