File tree 2 files changed +5
-3
lines changed
2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,8 @@ fn unsize_ptr<'tcx>(
88
88
let src_f = src_layout. field ( fx, i) ;
89
89
assert_eq ! ( src_layout. fields. offset( i) . bytes( ) , 0 ) ;
90
90
assert_eq ! ( dst_layout. fields. offset( i) . bytes( ) , 0 ) ;
91
- if src_f. is_zst ( ) {
91
+ if src_f. is_1zst ( ) {
92
+ // We are looking for the one non-1-ZST field; this is not it.
92
93
continue ;
93
94
}
94
95
assert_eq ! ( src_layout. size, src_f. size) ;
@@ -151,6 +152,7 @@ pub(crate) fn coerce_unsized_into<'tcx>(
151
152
let dst_f = dst. place_field ( fx, FieldIdx :: new ( i) ) ;
152
153
153
154
if dst_f. layout ( ) . is_zst ( ) {
155
+ // No data here, nothing to copy/coerce.
154
156
continue ;
155
157
}
156
158
Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>(
51
51
' descend_newtypes: while !arg. layout ( ) . ty . is_unsafe_ptr ( ) && !arg. layout ( ) . ty . is_ref ( ) {
52
52
for i in 0 ..arg. layout ( ) . fields . count ( ) {
53
53
let field = arg. value_field ( fx, FieldIdx :: new ( i) ) ;
54
- if !field. layout ( ) . is_zst ( ) {
55
- // we found the one non-zero-sized field that is allowed
54
+ if !field. layout ( ) . is_1zst ( ) {
55
+ // we found the one non-1-ZST field that is allowed
56
56
// now find *its* non-zero-sized field, or stop if it's a
57
57
// pointer
58
58
arg = field;
You can’t perform that action at this time.
0 commit comments