Avoid silencing relevant follow-up errors

This commit is contained in:
Oli Scherer 2023-10-31 13:45:26 +00:00
parent be00c5a9b8
commit 0978f6e010
184 changed files with 2700 additions and 631 deletions

View file

@ -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