about summary refs log tree commit diff
path: root/compiler/rustc_transmute/src/layout/tree.rs
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-06-27 22:13:06 +0200
committerGitHub <noreply@github.com>2025-06-27 22:13:06 +0200
commit994ed31a96d411ef1ac0efedab38c17986752e6d (patch)
tree106c0d914020fe184aea401bc1d83d0809ba7ac9 /compiler/rustc_transmute/src/layout/tree.rs
parent088f6ab1c5127b5272056c0b27ee1fe06a943a57 (diff)
parent5af79242ac1b04f3ab79548f782dacac331a2f67 (diff)
downloadrust-994ed31a96d411ef1ac0efedab38c17986752e6d.tar.gz
rust-994ed31a96d411ef1ac0efedab38c17986752e6d.zip
Rollup merge of #143096 - RalfJung:tag_for_variant, r=compiler-errors
tag_for_variant: properly pass TypingEnv

Hard-coding `fully_monomorphized` here does not seem right...

This came up [on Zulip](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20VariantId.3DDiscriminant.20when.20tag.20is.20niche.20encoded.3F/with/526103956).
Diffstat (limited to 'compiler/rustc_transmute/src/layout/tree.rs')
-rw-r--r--compiler/rustc_transmute/src/layout/tree.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs
index 372b4f5353a..150f5d118e0 100644
--- a/compiler/rustc_transmute/src/layout/tree.rs
+++ b/compiler/rustc_transmute/src/layout/tree.rs
@@ -432,7 +432,9 @@ pub(crate) mod rustc {
                     if variant_layout.is_uninhabited() {
                         return Ok(Self::uninhabited());
                     }
-                    let tag = cx.tcx().tag_for_variant((cx.tcx().erase_regions(ty), index));
+                    let tag = cx.tcx().tag_for_variant(
+                        cx.typing_env.as_query_input((cx.tcx().erase_regions(ty), index)),
+                    );
                     let variant_def = Def::Variant(def.variant(index));
                     Self::from_variant(
                         variant_def,