File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
compiler/rustc_codegen_llvm/src Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -80,8 +80,7 @@ pub struct CodegenCx<'ll, 'tcx> {
8080 pub isize_ty : & ' ll Type ,
8181
8282 /// Cache for the mapping from source index to llvm index for struct fields,
83- /// necessary because the mapping depends on padding and thus depens on
84- /// TyAndLayout.
83+ /// only present if synthetic fields are inserted for padding.
8584 pub field_projection_cache : RefCell < FxHashMap < TyAndLayout < ' tcx > , Vec < u32 > > > ,
8685
8786 pub coverage_cx : Option < coverageinfo:: CrateCoverageContext < ' ll , ' tcx > > ,
Original file line number Diff line number Diff line change @@ -363,6 +363,8 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
363363
364364 FieldsShape :: Array { .. } => index as u64 ,
365365
366+ // Look up llvm field index in projection cache if present. If no projection cache
367+ // is present no padding is used and the llvm field index matches the memory index.
366368 FieldsShape :: Arbitrary { .. } => match cx. field_projection_cache . borrow ( ) . get ( self ) {
367369 Some ( projection) => projection[ index] as u64 ,
368370 None => self . fields . memory_index ( index) as u64 ,
You can’t perform that action at this time.
0 commit comments