Skip to content

Commit 126aa76

Browse files
committed
w
1 parent f0f4405 commit 126aa76

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

compiler/rustc_const_eval/src/const_eval/eval_queries.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ pub fn eval_to_const_value_raw_provider<'tcx>(
290290
let ty::FnDef(_, args) = ty.kind() else {
291291
bug!("intrinsic with type {:?}", ty);
292292
};
293-
return eval_nullary_intrinsic(tcx, typing_env, def_id, args).report_err().map_err(
293+
return eval_nullary_intrinsic(tcx, key.param_env, def_id, args).report_err().map_err(
294294
|error| {
295295
let span = tcx.def_span(def_id);
296296

compiler/rustc_const_eval/src/const_eval/machine.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,7 @@ impl<'tcx> CompileTimeInterpCx<'tcx> {
249249
} else if self.tcx.is_lang_item(def_id, LangItem::PanicFmt) {
250250
// For panic_fmt, call const_panic_fmt instead.
251251
let const_def_id = self.tcx.require_lang_item(LangItem::ConstPanicFmt, None);
252-
253-
// TODO why does this use an empty env if we've got a `param_env` right here.
252+
// FIXME(@lcnr): why does this use an empty env if we've got a `param_env` right here.
254253
let new_instance = ty::Instance::expect_resolve(
255254
*self.tcx,
256255
ty::TypingEnv::fully_monomorphized(),

compiler/rustc_const_eval/src/interpret/intrinsics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@ pub(crate) fn alloc_type_name<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> ConstAll
3434
/// inside an `InterpCx` and instead have their value computed directly from rustc internal info.
3535
pub(crate) fn eval_nullary_intrinsic<'tcx>(
3636
tcx: TyCtxt<'tcx>,
37-
typing_env: ty::TypingEnv<'tcx>,
37+
param_env: ty::ParamEnv<'tcx>,
3838
def_id: DefId,
3939
args: GenericArgsRef<'tcx>,
4040
) -> InterpResult<'tcx, ConstValue<'tcx>> {
4141
let tp_ty = args.type_at(0);
4242
let name = tcx.item_name(def_id);
43+
let typing_env = ty::TypingEnv { typing_mode: ty::TypingMode::PostAnalysis, param_env };
4344
interp_ok(match name {
4445
sym::type_name => {
4546
ensure_monomorphic_enough(tcx, tp_ty)?;

0 commit comments

Comments
 (0)