diff options
| author | Ralf Jung <post@ralfj.de> | 2025-06-27 17:02:47 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-06-27 17:04:33 +0200 |
| commit | 5af79242ac1b04f3ab79548f782dacac331a2f67 (patch) | |
| tree | d8117e504b973e2b3e7d948b2fa1fd66de1b8ac3 /compiler/rustc_const_eval/src | |
| parent | e61dd437f33b5a640e67dc3628397689c664c17f (diff) | |
tag_for_variant: properly pass TypingEnv
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/const_eval/mod.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/mod.rs b/compiler/rustc_const_eval/src/const_eval/mod.rs index 73cb1e77436..9e65161f64a 100644 --- a/compiler/rustc_const_eval/src/const_eval/mod.rs +++ b/compiler/rustc_const_eval/src/const_eval/mod.rs @@ -67,18 +67,13 @@ pub(crate) fn try_destructure_mir_constant_for_user_output<'tcx>( #[instrument(skip(tcx), level = "debug")] pub fn tag_for_variant_provider<'tcx>( tcx: TyCtxt<'tcx>, - (ty, variant_index): (Ty<'tcx>, VariantIdx), + key: ty::PseudoCanonicalInput<'tcx, (Ty<'tcx>, VariantIdx)>, ) -> Option<ty::ScalarInt> { + let (ty, variant_index) = key.value; assert!(ty.is_enum()); - // FIXME: This uses an empty `TypingEnv` even though - // it may be used by a generic CTFE. - let ecx = InterpCx::new( - tcx, - ty.default_span(tcx), - ty::TypingEnv::fully_monomorphized(), - crate::const_eval::DummyMachine, - ); + let ecx = + InterpCx::new(tcx, ty.default_span(tcx), key.typing_env, crate::const_eval::DummyMachine); let layout = ecx.layout_of(ty).unwrap(); ecx.tag_for_variant(layout, variant_index).unwrap().map(|(tag, _tag_field)| tag) |
