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> {
80
80
pub isize_ty : & ' ll Type ,
81
81
82
82
/// 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.
85
84
pub field_projection_cache : RefCell < FxHashMap < TyAndLayout < ' tcx > , Vec < u32 > > > ,
86
85
87
86
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> {
363
363
364
364
FieldsShape :: Array { .. } => index as u64 ,
365
365
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.
366
368
FieldsShape :: Arbitrary { .. } => match cx. field_projection_cache . borrow ( ) . get ( self ) {
367
369
Some ( projection) => projection[ index] as u64 ,
368
370
None => self . fields . memory_index ( index) as u64 ,
You can’t perform that action at this time.
0 commit comments