Skip to content

Commit 8407952

Browse files
committed
Do not emit "class method" debuginfo for types that are not DICompositeType.
1 parent e07dd59 commit 8407952

File tree

1 file changed

+9
-1
lines changed
  • src/librustc_trans/debuginfo

1 file changed

+9
-1
lines changed

src/librustc_trans/debuginfo/mod.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,15 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
419419
let impl_self_ty = monomorphize::apply_param_substs(cx.tcx(),
420420
instance.substs,
421421
&impl_self_ty);
422-
Some(type_metadata(cx, impl_self_ty, syntax_pos::DUMMY_SP))
422+
423+
// Only "class" methods are generally understood by LLVM,
424+
// so avoid methods on other types (e.g. `<*mut T>::null`).
425+
match impl_self_ty.sty {
426+
ty::TyStruct(..) | ty::TyEnum(..) => {
427+
Some(type_metadata(cx, impl_self_ty, syntax_pos::DUMMY_SP))
428+
}
429+
_ => None
430+
}
423431
} else {
424432
// For trait method impls we still use the "parallel namespace"
425433
// strategy

0 commit comments

Comments
 (0)