diff options
| author | Michael Goulet <michael@errs.io> | 2022-12-17 22:32:57 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-12-17 22:33:06 +0000 |
| commit | c1181e12243f078b1cc562249569e6766d90f8f6 (patch) | |
| tree | 6ed4cea2eb72fbc836e11a1967d27c7156a2871b /compiler/rustc_const_eval/src/interpret | |
| parent | 984eab57f708e62c09b3d708033fe620130b5f39 (diff) | |
| download | rust-c1181e12243f078b1cc562249569e6766d90f8f6.tar.gz rust-c1181e12243f078b1cc562249569e6766d90f8f6.zip | |
Ensure param-env is const before calling eval_to_valtree
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/operand.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/operand.rs b/compiler/rustc_const_eval/src/interpret/operand.rs index 221e359d24a..5bc2e3dd4fc 100644 --- a/compiler/rustc_const_eval/src/interpret/operand.rs +++ b/compiler/rustc_const_eval/src/interpret/operand.rs @@ -569,8 +569,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { ty::ConstKind::Unevaluated(uv) => { let instance = self.resolve(uv.def, uv.substs)?; let cid = GlobalId { instance, promoted: None }; - self.ctfe_query(span, |tcx| tcx.eval_to_valtree(self.param_env.and(cid)))? - .unwrap_or_else(|| bug!("unable to create ValTree for {uv:?}")) + self.ctfe_query(span, |tcx| { + tcx.eval_to_valtree(self.param_env.with_const().and(cid)) + })? + .unwrap_or_else(|| bug!("unable to create ValTree for {uv:?}")) } ty::ConstKind::Bound(..) | ty::ConstKind::Infer(..) => { span_bug!(self.cur_span(), "unexpected ConstKind in ctfe: {val:?}") |
