Skip to content

Commit cd014cd

Browse files
committed
Replace the type of global variables instead of replacing them
1 parent 606196b commit cd014cd

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libgccjit.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
272d0ccced960394fe6ff2b40b01610208cb4940
1+
341be3b7d7ac6976cfed8ed59da3573c040d0776

src/consts.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,11 @@ impl<'gcc, 'tcx> StaticMethods for CodegenCx<'gcc, 'tcx> {
8282
};
8383

8484
let is_thread_local = attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL);
85-
let mut global = self.get_static_inner(def_id, val_llty);
85+
let global = self.get_static_inner(def_id, val_llty);
8686

8787
#[cfg(feature = "master")]
8888
if global.to_rvalue().get_type() != val_llty {
89-
let instance = Instance::mono(self.tcx, def_id);
90-
self.instances.borrow_mut().remove(&instance);
91-
92-
global.remove();
93-
let name = self.tcx.symbol_name(instance).name;
94-
self.globals.borrow_mut().remove(name);
95-
global = self.get_static_inner(def_id, val_llty);
89+
global.to_rvalue().set_type(val_llty);
9690
}
9791
set_global_alignment(self, global, alloc.align);
9892

0 commit comments

Comments
 (0)