rust/compiler/rustc_codegen_llvm/src/value.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
668 B
Rust
Raw Normal View History

2019-02-17 18:58:58 +00:00
pub use crate::llvm::Value;
2019-02-17 18:58:58 +00:00
use crate::llvm;
use std::fmt;
use std::hash::{Hash, Hasher};
2019-01-12 15:13:33 +00:00
use std::ptr;
impl PartialEq for Value {
fn eq(&self, other: &Self) -> bool {
2019-01-12 15:13:33 +00:00
ptr::eq(self, other)
}
}
impl Eq for Value {}
impl Hash for Value {
fn hash<H: Hasher>(&self, hasher: &mut H) {
(self as *const Self).hash(hasher);
}
}
impl fmt::Debug for Value {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(
&llvm::build_string(|s| unsafe {
llvm::LLVMRustWriteValueToString(self, s);
})
.expect("non-UTF8 value description from LLVM"),
2019-12-22 22:42:04 +00:00
)
}
}