]> git.proxmox.com Git - rustc.git/blob - src/librustc_codegen_llvm/value.rs
New upstream version 1.47.0+dfsg1
[rustc.git] / src / librustc_codegen_llvm / value.rs
1 pub use crate::llvm::Value;
2
3 use crate::llvm;
4
5 use std::fmt;
6 use std::hash::{Hash, Hasher};
7 use std::ptr;
8
9 impl PartialEq for Value {
10 fn eq(&self, other: &Self) -> bool {
11 ptr::eq(self, other)
12 }
13 }
14
15 impl Eq for Value {}
16
17 impl Hash for Value {
18 fn hash<H: Hasher>(&self, hasher: &mut H) {
19 (self as *const Self).hash(hasher);
20 }
21 }
22
23 impl fmt::Debug for Value {
24 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25 f.write_str(
26 &llvm::build_string(|s| unsafe {
27 llvm::LLVMRustWriteValueToString(self, s);
28 })
29 .expect("non-UTF8 value description from LLVM"),
30 )
31 }
32 }