@@ -90,12 +90,12 @@ pub fn compute_fields<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>,
90
90
/// and fill in the actual contents in a second pass to prevent
91
91
/// unbounded recursion; see also the comments in `trans::type_of`.
92
92
pub fn type_of < ' a , ' tcx > ( cx : & CrateContext < ' a , ' tcx > , t : Ty < ' tcx > ) -> Type {
93
- generic_type_of ( cx, t, None , false )
93
+ generic_type_of ( cx, t, None )
94
94
}
95
95
96
96
pub fn incomplete_type_of < ' a , ' tcx > ( cx : & CrateContext < ' a , ' tcx > ,
97
97
t : Ty < ' tcx > , name : & str ) -> Type {
98
- generic_type_of ( cx, t, Some ( name) , false )
98
+ generic_type_of ( cx, t, Some ( name) )
99
99
}
100
100
101
101
pub fn finish_type_of < ' a , ' tcx > ( cx : & CrateContext < ' a , ' tcx > ,
@@ -114,7 +114,7 @@ pub fn finish_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
114
114
_ => unreachable ! ( )
115
115
} ;
116
116
let fields = compute_fields ( cx, t, nonnull_variant_index as usize , true ) ;
117
- llty. set_struct_body ( & struct_llfields ( cx, & fields, nonnull_variant, false ) ,
117
+ llty. set_struct_body ( & struct_llfields ( cx, & fields, nonnull_variant) ,
118
118
packed)
119
119
} ,
120
120
_ => bug ! ( "This function cannot handle {} with layout {:#?}" , t, l)
@@ -123,10 +123,9 @@ pub fn finish_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
123
123
124
124
fn generic_type_of < ' a , ' tcx > ( cx : & CrateContext < ' a , ' tcx > ,
125
125
t : Ty < ' tcx > ,
126
- name : Option < & str > ,
127
- sizing : bool ) -> Type {
126
+ name : Option < & str > ) -> Type {
128
127
let l = cx. layout_of ( t) ;
129
- debug ! ( "adt::generic_type_of t: {:?} name: {:?} sizing: {} " , t, name, sizing ) ;
128
+ debug ! ( "adt::generic_type_of t: {:?} name: {:?}" , t, name) ;
130
129
match * l {
131
130
layout:: CEnum { discr, .. } => Type :: from_integer ( cx, discr) ,
132
131
layout:: RawNullablePointer { nndiscr, .. } => {
@@ -146,11 +145,10 @@ fn generic_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
146
145
let fields = compute_fields ( cx, t, nndiscr as usize , false ) ;
147
146
match name {
148
147
None => {
149
- Type :: struct_ ( cx, & struct_llfields ( cx, & fields, nonnull, sizing ) ,
148
+ Type :: struct_ ( cx, & struct_llfields ( cx, & fields, nonnull) ,
150
149
nonnull. packed )
151
150
}
152
151
Some ( name) => {
153
- assert_eq ! ( sizing, false ) ;
154
152
Type :: named_struct ( cx, name)
155
153
}
156
154
}
@@ -161,13 +159,12 @@ fn generic_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
161
159
let fields = compute_fields ( cx, t, 0 , true ) ;
162
160
match name {
163
161
None => {
164
- let fields = struct_llfields ( cx, & fields, & variant, sizing ) ;
162
+ let fields = struct_llfields ( cx, & fields, & variant) ;
165
163
Type :: struct_ ( cx, & fields, variant. packed )
166
164
}
167
165
Some ( name) => {
168
166
// Hypothesis: named_struct's can never need a
169
167
// drop flag. (... needs validation.)
170
- assert_eq ! ( sizing, false ) ;
171
168
Type :: named_struct ( cx, name)
172
169
}
173
170
}
@@ -256,19 +253,14 @@ pub fn struct_llfields_index(variant: &layout::Struct, index: usize) -> usize {
256
253
257
254
258
255
pub fn struct_llfields < ' a , ' tcx > ( cx : & CrateContext < ' a , ' tcx > , field_tys : & Vec < Ty < ' tcx > > ,
259
- variant : & layout:: Struct ,
260
- sizing : bool ) -> Vec < Type > {
261
- if sizing {
262
- bug ! ( ) ;
263
- }
256
+ variant : & layout:: Struct ) -> Vec < Type > {
264
257
debug ! ( "struct_llfields: variant: {:?}" , variant) ;
265
258
let mut first_field = true ;
266
259
let mut min_offset = 0 ;
267
260
let mut result: Vec < Type > = Vec :: with_capacity ( field_tys. len ( ) * 2 ) ;
268
261
let field_iter = variant. field_index_by_increasing_offset ( ) . map ( |i| {
269
262
( i, field_tys[ i as usize ] , variant. offsets [ i as usize ] . bytes ( ) ) } ) ;
270
- for ( index, ty, target_offset) in field_iter. filter (
271
- |& ( _, ty, _) | !sizing || cx. shared ( ) . type_is_sized ( ty) ) {
263
+ for ( index, ty, target_offset) in field_iter {
272
264
if first_field {
273
265
debug ! ( "struct_llfields: {} ty: {} min_offset: {} target_offset: {}" ,
274
266
index, ty, min_offset, target_offset) ;
0 commit comments