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