about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/solve
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-22 20:45:24 +0000
committerbors <bors@rust-lang.org>2024-02-22 20:45:24 +0000
commit397937d812852f9bbeb671005cb399dbcb357cde (patch)
tree4af90ca24da0be119ccfadea6502ac0df79fa793 /compiler/rustc_trait_selection/src/solve
parentd9ae43c7879c83f08ea2e886b55ea0f6839c9ead (diff)
parentc71484eefd38d6d60a54981376f3b157789cc570 (diff)
Auto merge of #119989 - lcnr:sub_relations-bye-bye, r=compiler-errors
remove `sub_relations` from the `InferCtxt`

While doing so, I tried to remove the `delay_span_bug` in `rematch_impl` again, which lead me to discover another `freshen` bug, fixing that one in the second commit. See commit descriptions for the reasoning behind each change.

r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_trait_selection/src/solve')
-rw-r--r--compiler/rustc_trait_selection/src/solve/normalize.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/normalize.rs b/compiler/rustc_trait_selection/src/solve/normalize.rs
index 91312c9fdd6..b1c03e82cab 100644
--- a/compiler/rustc_trait_selection/src/solve/normalize.rs
+++ b/compiler/rustc_trait_selection/src/solve/normalize.rs
@@ -1,4 +1,4 @@
-use crate::traits::error_reporting::TypeErrCtxtExt;
+use crate::traits::error_reporting::{OverflowCause, TypeErrCtxtExt};
 use crate::traits::query::evaluate_obligation::InferCtxtExt;
 use crate::traits::{BoundVarReplacer, PlaceholderReplacer};
 use rustc_data_structures::stack::ensure_sufficient_stack;
@@ -60,8 +60,12 @@ impl<'tcx> NormalizationFolder<'_, 'tcx> {
         let tcx = infcx.tcx;
         let recursion_limit = tcx.recursion_limit();
         if !recursion_limit.value_within_limit(self.depth) {
+            let ty::Alias(_, data) = *alias_ty.kind() else {
+                unreachable!();
+            };
+
             self.at.infcx.err_ctxt().report_overflow_error(
-                &alias_ty,
+                OverflowCause::DeeplyNormalize(data),
                 self.at.cause.span,
                 true,
                 |_| {},
@@ -109,7 +113,7 @@ impl<'tcx> NormalizationFolder<'_, 'tcx> {
         let recursion_limit = tcx.recursion_limit();
         if !recursion_limit.value_within_limit(self.depth) {
             self.at.infcx.err_ctxt().report_overflow_error(
-                &ty::Const::new_unevaluated(tcx, uv, ty),
+                OverflowCause::DeeplyNormalize(ty::AliasTy::new(tcx, uv.def, uv.args)),
                 self.at.cause.span,
                 true,
                 |_| {},