about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-05-04 08:09:07 +0200
committerGitHub <noreply@github.com>2023-05-04 08:09:07 +0200
commitb4d992fec740dc9a6ff42a0500026fe5b25db74a (patch)
treee564cb140f4a1810a37345ae13ebf069c9969ff0 /compiler/rustc_middle/src/ty
parentf2bc7e0684f1c30dd93b1b18dda1b30037ec3881 (diff)
parent4d0887e1a27ab0f57515bdb01644db597c110bdd (diff)
downloadrust-b4d992fec740dc9a6ff42a0500026fe5b25db74a.tar.gz
rust-b4d992fec740dc9a6ff42a0500026fe5b25db74a.zip
Rollup merge of #111103 - BoxyUwU:normal_fold_with_gce_norm, r=compiler-errors
correctly recurse when expanding anon consts

recursing with `super_fold_with` is wrong in case `bac` is itself normalizable, the test that was supposed to test for this being wrong did not actually test for this in reality because of the usage of `{ (N) }` instead of `{{ N }}`. The former resulting in a simple `ConstKind::Param` instead of `ConstKind::Unevaluated`. Tbh generally this test seems very brittle and it will be a lot easier to test once we have normalization of assoc consts since then we can just test that `T::ASSOC` normalizes to some `U::OTHER` which normalizes to some third thing.

r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_middle/src/ty')
-rw-r--r--compiler/rustc_middle/src/ty/abstract_const.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/abstract_const.rs b/compiler/rustc_middle/src/ty/abstract_const.rs
index 029cf793ad8..bfb740ab356 100644
--- a/compiler/rustc_middle/src/ty/abstract_const.rs
+++ b/compiler/rustc_middle/src/ty/abstract_const.rs
@@ -63,7 +63,8 @@ impl<'tcx> TyCtxt<'tcx> {
                         Err(e) => self.tcx.const_error_with_guaranteed(c.ty(), e),
                         Ok(Some(bac)) => {
                             let substs = self.tcx.erase_regions(uv.substs);
-                            bac.subst(self.tcx, substs)
+                            let bac = bac.subst(self.tcx, substs);
+                            return bac.fold_with(self);
                         }
                         Ok(None) => c,
                     },