]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_codegen_llvm/src/common.rs
Auto merge of #101307 - jyn514:simplify-storage, r=cjgillot
[rust.git] / compiler / rustc_codegen_llvm / src / common.rs
index 488ea72c3b77991a7146f71ea24aac66cc981653..acee9134fb96e48a26c3d4eb7a465c8d66ac6bf9 100644 (file)
@@ -215,7 +215,11 @@ fn const_struct(&self, elts: &[&'ll Value], packed: bool) -> &'ll Value {
     }
 
     fn const_to_opt_uint(&self, v: &'ll Value) -> Option<u64> {
-        try_as_const_integral(v).map(|v| unsafe { llvm::LLVMConstIntGetZExtValue(v) })
+        try_as_const_integral(v).and_then(|v| unsafe {
+            let mut i = 0u64;
+            let success = llvm::LLVMRustConstIntGetZExtValue(v, &mut i);
+            success.then_some(i)
+        })
     }
 
     fn const_to_opt_u128(&self, v: &'ll Value, sign_ext: bool) -> Option<u128> {