From 12e2846514b4caf54430e1a7fc84626d2c39928f Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Fri, 23 Feb 2024 16:06:04 +0000 Subject: Stop requiring a type when codegenning types. We can get all the type info we need from the `ConstAllocation` --- compiler/rustc_codegen_llvm/src/consts.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'compiler/rustc_codegen_llvm') diff --git a/compiler/rustc_codegen_llvm/src/consts.rs b/compiler/rustc_codegen_llvm/src/consts.rs index 4dde7ec9cf3..8acb3de8867 100644 --- a/compiler/rustc_codegen_llvm/src/consts.rs +++ b/compiler/rustc_codegen_llvm/src/consts.rs @@ -354,18 +354,11 @@ impl<'ll> CodegenCx<'ll, '_> { }; let alloc = alloc.inner(); - let instance = Instance::mono(self.tcx, def_id); - let ty = instance.ty(self.tcx, ty::ParamEnv::reveal_all()); - if !self.tcx.is_mutable_static(def_id) { - debug_assert_eq!(alloc.mutability.is_not(), self.type_is_freeze(ty)); - } - debug_assert_eq!(alloc.align, self.align_of(ty)); - let llty = self.layout_of(ty).llvm_type(self); - - let g = self.get_static_inner(def_id, llty); - let val_llty = self.val_ty(v); + let g = self.get_static_inner(def_id, val_llty); + let llty = self.val_ty(g); + let g = if val_llty == llty { g } else { -- cgit 1.4.1-3-g733a5