Skip to content

Commit

Permalink
add comment explaining why ty_and_layout_field is not used
Browse files Browse the repository at this point in the history
Co-authored-by: Jack Wrenn <me@jswrenn.com>
  • Loading branch information
RalfJung and jswrenn committed Dec 4, 2024
1 parent 0e0bc6e commit 316c70f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/rustc_transmute/src/layout/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 316c70f

Please sign in to comment.