Skip to content

Commit bc46eb0

Browse files
committed
Don't specify the fields in struct initializer
1 parent 7ccc436 commit bc46eb0

File tree

3 files changed

+1
-8
lines changed

3 files changed

+1
-8
lines changed

src/common.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,7 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
186186
// TODO(antoyo): cache the type? It's anonymous, so probably not.
187187
let typ = self.type_struct(&fields, packed);
188188
let struct_type = typ.is_struct().expect("struct type");
189-
let struct_fields = self.struct_fields.borrow();
190-
let fields = struct_fields.get(&typ)
191-
.expect("struct fields");
192-
self.context.new_struct_constructor(None, struct_type.as_type(), &fields, values)
189+
self.context.new_struct_constructor(None, struct_type.as_type(), None, values)
193190
}
194191

195192
fn const_to_opt_uint(&self, _v: RValue<'gcc>) -> Option<u64> {

src/context.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ pub struct CodegenCx<'gcc, 'tcx> {
7171
pub tcx: TyCtxt<'tcx>,
7272

7373
pub struct_types: RefCell<FxHashMap<Vec<Type<'gcc>>, Type<'gcc>>>,
74-
pub struct_fields: RefCell<FxHashMap<Type<'gcc>, Vec<Field<'gcc>>>>,
7574

7675
pub types_with_fields_to_set: RefCell<FxHashMap<Type<'gcc>, (Struct<'gcc>, TyAndLayout<'tcx>)>>,
7776

@@ -202,7 +201,6 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
202201
types: Default::default(),
203202
tcx,
204203
struct_types: Default::default(),
205-
struct_fields: Default::default(),
206204
types_with_fields_to_set: Default::default(),
207205
local_gen_sym_counter: Cell::new(0),
208206
global_gen_sym_counter: Cell::new(0),

src/type_.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
115115
// TODO(antoyo): use packed.
116116
let typ = self.context.new_struct_type(None, "struct", &fields).as_type();
117117
self.struct_types.borrow_mut().insert(types, typ);
118-
self.struct_fields.borrow_mut().insert(typ, fields);
119118
typ
120119
}
121120

@@ -216,7 +215,6 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
216215
.map(|(index, field)| self.context.new_field(None, *field, &format!("field_{}", index)))
217216
.collect();
218217
typ.set_fields(None, &fields);
219-
self.struct_fields.borrow_mut().insert(typ.as_type(), fields);
220218
}
221219

222220
pub fn type_named_struct(&self, name: &str) -> Struct<'gcc> {

0 commit comments

Comments
 (0)