Skip to content

Commit 5bf2c7d

Browse files
committed
debuginfo: no type metadata if substs reqd
This commit skips generating debuginfo type metadata if substitutions are required by the type. This avoids ICEs that result from layouts of types with substitutions being computed. Signed-off-by: David Wood <david@davidtw.co>
1 parent 842fa0c commit 5bf2c7d

File tree

1 file changed

+4
-2
lines changed
  • src/librustc_codegen_llvm/debuginfo

1 file changed

+4
-2
lines changed

src/librustc_codegen_llvm/debuginfo/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use rustc_index::vec::IndexVec;
2626
use rustc_middle::mir;
2727
use rustc_middle::ty::layout::HasTyCtxt;
2828
use rustc_middle::ty::subst::{GenericArgKind, SubstsRef};
29-
use rustc_middle::ty::{self, Instance, ParamEnv, Ty};
29+
use rustc_middle::ty::{self, Instance, ParamEnv, Ty, TypeFoldable};
3030
use rustc_session::config::{self, DebugInfo};
3131
use rustc_span::symbol::Symbol;
3232
use rustc_span::{self, BytePos, Span};
@@ -470,7 +470,9 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
470470
match impl_self_ty.kind {
471471
ty::Adt(def, ..) if !def.is_box() => {
472472
// Again, only create type information if full debuginfo is enabled
473-
if cx.sess().opts.debuginfo == DebugInfo::Full {
473+
if cx.sess().opts.debuginfo == DebugInfo::Full
474+
&& !impl_self_ty.needs_subst()
475+
{
474476
Some(type_metadata(cx, impl_self_ty, rustc_span::DUMMY_SP))
475477
} else {
476478
Some(namespace::item_namespace(cx, def.did))

0 commit comments

Comments
 (0)