about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-12-02 17:56:18 +0100
committerRalf Jung <post@ralfj.de>2024-12-18 11:01:54 +0100
commit85f01386daef14e107cb87c27fc6271f1f2fa584 (patch)
tree3f8321bbfd92dc3a719c3b2d687b08d8a27f5bda /compiler
parente023590de407f417e0f3da675a372eca7acf60c6 (diff)
downloadrust-85f01386daef14e107cb87c27fc6271f1f2fa584.tar.gz
rust-85f01386daef14e107cb87c27fc6271f1f2fa584.zip
add comment explaining why ty_and_layout_field is not used
Co-authored-by: Jack Wrenn <me@jswrenn.com>
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_transmute/src/layout/tree.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs
index 4cc6292a3ee..6ce9969aefe 100644
--- a/compiler/rustc_transmute/src/layout/tree.rs
+++ b/compiler/rustc_transmute/src/layout/tree.rs
@@ -495,7 +495,10 @@ pub(crate) mod rustc {
         (ty, layout): (Ty<'tcx>, Layout<'tcx>),
         i: FieldIdx,
     ) -> Ty<'tcx> {
-        // FIXME: Why does this not just use `ty_and_layout_field`?
+        // We cannot use `ty_and_layout_field` to retrieve the field type, since
+        // `ty_and_layout_field` erases regions in the returned type. We must
+        // not erase regions here, since we may need to ultimately emit outlives
+        // obligations as a consequence of the transmutability analysis.
         match ty.kind() {
             ty::Adt(def, args) => {
                 match layout.variants {