@@ -99,6 +99,8 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> {
99
99
let offset = self . layout . fields . offset ( ix) ;
100
100
let effective_field_align = self . align . restrict_for_offset ( offset) ;
101
101
102
+ // `simple` is called when we don't need to adjust the offset to
103
+ // the dynamic alignment of the field.
102
104
let mut simple = || {
103
105
let llval = match self . layout . abi {
104
106
_ if offset. bytes ( ) == 0 => {
@@ -141,19 +143,13 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> {
141
143
} ;
142
144
143
145
// Simple cases, which don't need DST adjustment:
144
- // * no metadata available - just log the case
145
- // * known alignment - sized types, `[T]`, `str` or a foreign type
146
+ // * known alignment - sized types, `[T]`, `str`
147
+ // * offset 0 -- rounding up to alignment cannot change the offset
146
148
// * packed struct - there is no alignment padding
147
149
match field. ty . kind ( ) {
148
- _ if self . llextra . is_none ( ) => {
149
- debug ! (
150
- "unsized field `{}`, of `{:?}` has no metadata for adjustment" ,
151
- ix, self . llval
152
- ) ;
153
- return simple ( ) ;
154
- }
155
150
_ if field. is_sized ( ) => return simple ( ) ,
156
- ty:: Slice ( ..) | ty:: Str | ty:: Foreign ( ..) => return simple ( ) ,
151
+ ty:: Slice ( ..) | ty:: Str => return simple ( ) ,
152
+ _ if offset. bytes ( ) == 0 => return simple ( ) ,
157
153
ty:: Adt ( def, _) => {
158
154
if def. repr ( ) . packed ( ) {
159
155
// FIXME(eddyb) generalize the adjustment when we
0 commit comments