about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard Burtescu <edy.burt@gmail.com>2016-08-26 07:39:17 +0300
committerEduard Burtescu <edy.burt@gmail.com>2016-08-26 07:39:17 +0300
commit840795234695eda5c0be1ae8481add2e897f8bbf (patch)
tree01f3bd8d952ad10491658812e5bd1e3562cc3dee
parente07dd59eaeb7be95afd2fb3dc131108ae750c91c (diff)
downloadrust-840795234695eda5c0be1ae8481add2e897f8bbf.tar.gz
rust-840795234695eda5c0be1ae8481add2e897f8bbf.zip
Do not emit "class method" debuginfo for types that are not DICompositeType.
-rw-r--r--src/librustc_trans/debuginfo/mod.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/librustc_trans/debuginfo/mod.rs b/src/librustc_trans/debuginfo/mod.rs
index 58425cf60d5..73ed7a5510f 100644
--- a/src/librustc_trans/debuginfo/mod.rs
+++ b/src/librustc_trans/debuginfo/mod.rs
@@ -419,7 +419,15 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                 let impl_self_ty = monomorphize::apply_param_substs(cx.tcx(),
                                                                     instance.substs,
                                                                     &impl_self_ty);
-                Some(type_metadata(cx, impl_self_ty, syntax_pos::DUMMY_SP))
+
+                // Only "class" methods are generally understood by LLVM,
+                // so avoid methods on other types (e.g. `<*mut T>::null`).
+                match impl_self_ty.sty {
+                    ty::TyStruct(..) | ty::TyEnum(..) => {
+                        Some(type_metadata(cx, impl_self_ty, syntax_pos::DUMMY_SP))
+                    }
+                    _ => None
+                }
             } else {
                 // For trait method impls we still use the "parallel namespace"
                 // strategy