about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-08-26 15:18:03 -0700
committerGitHub <noreply@github.com>2016-08-26 15:18:03 -0700
commit1987131063f08afc54d57cdba56c2acddcff191d (patch)
tree5ac66d2c457982e096cba0867c54ef7c8a4ebd91
parentd00c2454157713e77729989c715b96ee31c6b278 (diff)
parent840795234695eda5c0be1ae8481add2e897f8bbf (diff)
downloadrust-1987131063f08afc54d57cdba56c2acddcff191d.tar.gz
rust-1987131063f08afc54d57cdba56c2acddcff191d.zip
Auto merge of #36008 - eddyb:compound-fail, r=michaelwoerister
Do not emit "class method" debuginfo for types that are not DICompositeType.

Fixes #35991 by restricting the "class method" debuginfo sugar from #33358 to structs and enums only.

r? @michaelwoerister
-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