1
Fork 0

Do not fail evaluation in const blocks

This commit is contained in:
Michael Goulet 2022-01-14 03:39:29 -08:00
parent 22e491ac7e
commit b9a3c32f31
3 changed files with 39 additions and 1 deletions

View file

@ -1226,7 +1226,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let body = self.tcx.hir().body(anon_const.body);
// Create a new function context.
let fcx = FnCtxt::new(self, self.param_env, body.value.hir_id);
let fcx = FnCtxt::new(self, self.param_env.with_const(), body.value.hir_id);
crate::check::GatherLocalsVisitor::new(&fcx).visit_body(body);
let ty = fcx.check_expr_with_expectation(&body.value, expected);