about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2015-07-27 14:40:55 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2015-07-28 20:08:29 +0200
commit39ec9f850b05bafd6af7e1d3c143bc56b21f7742 (patch)
treef530882b58c3db45cf55f9ef55060143a3d16986
parent661a5ad38e79f336976b529aa717871d177ab7ed (diff)
downloadrust-39ec9f850b05bafd6af7e1d3c143bc56b21f7742.tar.gz
rust-39ec9f850b05bafd6af7e1d3c143bc56b21f7742.zip
trans: Add Type::to_string method to improve options for debug output.
-rw-r--r--src/librustc_trans/trans/type_.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/librustc_trans/trans/type_.rs b/src/librustc_trans/trans/type_.rs
index c88509dac4c..699115a0709 100644
--- a/src/librustc_trans/trans/type_.rs
+++ b/src/librustc_trans/trans/type_.rs
@@ -50,6 +50,12 @@ impl Type {
         self.rf
     }
 
+    pub fn to_string(self: Type) -> String {
+        llvm::build_string(|s| unsafe {
+            llvm::LLVMWriteTypeToString(self.to_ref(), s);
+        }).expect("non-UTF8 type description from LLVM")
+    }
+
     pub fn void(ccx: &CrateContext) -> Type {
         ty!(llvm::LLVMVoidTypeInContext(ccx.llcx()))
     }
@@ -315,9 +321,7 @@ impl TypeNames {
     }
 
     pub fn type_to_string(&self, ty: Type) -> String {
-        llvm::build_string(|s| unsafe {
-                llvm::LLVMWriteTypeToString(ty.to_ref(), s);
-            }).expect("non-UTF8 type description from LLVM")
+        ty.to_string()
     }
 
     pub fn types_to_str(&self, tys: &[Type]) -> String {