about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-10-31 13:45:26 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-01-09 21:08:16 +0000
commit0978f6e010e0eb3dddfa2a1a374ae5567e1f7f4c (patch)
tree088de30be238d47fcc5889f5e5eae9298366e92b /compiler/rustc_trait_selection
parentbe00c5a9b89161b7f45ba80340f709e8e41122f9 (diff)
downloadrust-0978f6e010e0eb3dddfa2a1a374ae5567e1f7f4c.tar.gz
rust-0978f6e010e0eb3dddfa2a1a374ae5567e1f7f4c.zip
Avoid silencing relevant follow-up errors
Diffstat (limited to 'compiler/rustc_trait_selection')
-rw-r--r--compiler/rustc_trait_selection/src/traits/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs
index c52b8f37ef3..080ad7bd549 100644
--- a/compiler/rustc_trait_selection/src/traits/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/mod.rs
@@ -279,6 +279,12 @@ pub fn normalize_param_env_or_error<'tcx>(
                 }
 
                 fn fold_const(&mut self, c: ty::Const<'tcx>) -> ty::Const<'tcx> {
+                    // FIXME(return_type_notation): track binders in this normalizer, as
+                    // `ty::Const::normalize` can only work with properly preserved binders.
+
+                    if c.has_escaping_bound_vars() {
+                        return ty::Const::new_misc_error(self.0, c.ty());
+                    }
                     // While it is pretty sus to be evaluating things with an empty param env, it
                     // should actually be okay since without `feature(generic_const_exprs)` the only
                     // const arguments that have a non-empty param env are array repeat counts. These