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
This commit is contained in:
commit
539175c026
3 changed files with 39 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue