about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-01-15 11:28:28 +0100
committerGitHub <noreply@github.com>2022-01-15 11:28:28 +0100
commit539175c026c70e32150ca8c5ed2e0bacd3bb12e6 (patch)
treeff0a003ba0175b321403bff0885636893e33b818 /compiler
parent784e4ba9a4bcbda44021c6ca8345819c91b45066 (diff)
parentb9a3c32f31d4aff6988c678036c563c4b425f0bc (diff)
downloadrust-539175c026c70e32150ca8c5ed2e0bacd3bb12e6.tar.gz
rust-539175c026c70e32150ca8c5ed2e0bacd3bb12e6.zip
Rollup merge of #92892 - compiler-errors:const-param-env-for-const-block, r=fee1-dead
Do not fail evaluation in const blocks

Evaluate const blocks with a const param-env, so we properly check `~const` trait bounds.

Fixes #92713
(I will fix the poor diagnostics in #92713 and #92712 in a separate PR)

cc `@nbdd0121` who wrote the code this PR touches in #89561
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_typeck/src/check/expr.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_typeck/src/check/expr.rs b/compiler/rustc_typeck/src/check/expr.rs
index 14180526d84..faf3ef1e543 100644
--- a/compiler/rustc_typeck/src/check/expr.rs
+++ b/compiler/rustc_typeck/src/check/expr.rs
@@ -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);