Skip to content

Commit fb9060a

Browse files
committed
Revert "Ensure llvm doesn't trigger an assert for crazy transmutes"
This reverts commit 776c632e2a9a044fd134321a9d561e28994ff3ff.
1 parent 85de4ef commit fb9060a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/librustc_codegen_llvm/mir/constant.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ pub fn scalar_to_llvm(cx: &CodegenCx,
7070
&C_usize(cx, ptr.offset.bytes()),
7171
1,
7272
) };
73-
let llval = unsafe { llvm::LLVMConstPtrToInt(llval, llty.to_ref()) };
74-
consts::bitcast(llval, llty)
73+
if layout.value != layout::Pointer {
74+
unsafe { llvm::LLVMConstPtrToInt(llval, llty.to_ref()) }
75+
} else {
76+
consts::bitcast(llval, llty)
77+
}
7578
}
7679
}
7780
}

0 commit comments

Comments
 (0)