From cd014cda8c09afd88f6a9b8d75043c1d95bee734 Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Tue, 2 Jul 2024 09:54:01 -0400 Subject: [PATCH] Replace the type of global variables instead of replacing them --- Cargo.lock | 4 ++-- libgccjit.version | 2 +- src/consts.rs | 10 ++-------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ba6633bc2dc..cd693835ded 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -80,7 +80,7 @@ dependencies = [ [[package]] name = "gccjit" version = "2.0.0" -source = "git+https://github.com/rust-lang/gccjit.rs#f1545d7c2c13e42d78eaac8032d49ab8f7d43b6e" +source = "git+https://github.com/rust-lang/gccjit.rs#328cb1b414f67dfa15162ba7a55ed01931f1b219" dependencies = [ "gccjit_sys", ] @@ -88,7 +88,7 @@ dependencies = [ [[package]] name = "gccjit_sys" version = "0.1.0" -source = "git+https://github.com/rust-lang/gccjit.rs#f1545d7c2c13e42d78eaac8032d49ab8f7d43b6e" +source = "git+https://github.com/rust-lang/gccjit.rs#328cb1b414f67dfa15162ba7a55ed01931f1b219" dependencies = [ "libc", ] diff --git a/libgccjit.version b/libgccjit.version index 71a61a4b873..23ca7f02215 100644 --- a/libgccjit.version +++ b/libgccjit.version @@ -1 +1 @@ -272d0ccced960394fe6ff2b40b01610208cb4940 +341be3b7d7ac6976cfed8ed59da3573c040d0776 diff --git a/src/consts.rs b/src/consts.rs index 93c23440c57..50f3a4e0402 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -82,17 +82,11 @@ fn codegen_static(&self, def_id: DefId) { }; let is_thread_local = attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL); - let mut global = self.get_static_inner(def_id, val_llty); + let global = self.get_static_inner(def_id, val_llty); #[cfg(feature = "master")] if global.to_rvalue().get_type() != val_llty { - let instance = Instance::mono(self.tcx, def_id); - self.instances.borrow_mut().remove(&instance); - - global.remove(); - let name = self.tcx.symbol_name(instance).name; - self.globals.borrow_mut().remove(name); - global = self.get_static_inner(def_id, val_llty); + global.to_rvalue().set_type(val_llty); } set_global_alignment(self, global, alloc.align);