Skip to content

Commit 316c70f

Browse files
RalfJungjswrenn
andcommitted
add comment explaining why ty_and_layout_field is not used
Co-authored-by: Jack Wrenn <[email protected]>
1 parent 0e0bc6e commit 316c70f

File tree

1 file changed

+4
-1
lines changed
  • compiler/rustc_transmute/src/layout

1 file changed

+4
-1
lines changed

Diff for: compiler/rustc_transmute/src/layout/tree.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,10 @@ pub(crate) mod rustc {
495495
(ty, layout): (Ty<'tcx>, Layout<'tcx>),
496496
i: FieldIdx,
497497
) -> Ty<'tcx> {
498-
// FIXME: Why does this not just use `ty_and_layout_field`?
498+
// We cannot use `ty_and_layout_field` to retrieve the field type, since
499+
// `ty_and_layout_field` erases regions in the returned type. We must
500+
// not erase regions here, since we may need to ultimately emit outlives
501+
// obligations as a consequence of the transmutability analysis.
499502
match ty.kind() {
500503
ty::Adt(def, args) => {
501504
match layout.variants {

0 commit comments

Comments
 (0)