Skip to content

Commit 2b45591

Browse files
committed
Made unimplemented debuginfo a note rather than a compiler error.
1 parent 51d82f5 commit 2b45591

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

src/librustc/middle/trans/debuginfo.rs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,17 @@ fn create_fn_ty(cx: @CrateContext, fn_ty: ty::t, inputs: ~[ty::t], output: ty::t
482482
};
483483
}
484484

485+
fn create_unimpl_ty(cx: @CrateContext, t: ty::t) -> DIType {
486+
let dcx = dbg_cx(cx);
487+
let name = ty_to_str(cx.tcx, t);
488+
let md = do as_c_str(fmt!("NYI<%s>", name)) |name| { unsafe {
489+
llvm::LLVMDIBuilderCreateBasicType(
490+
dcx.builder, name,
491+
0_u64, 8_u64, DW_ATE_unsigned as c_uint)
492+
}};
493+
return md;
494+
}
495+
485496
fn create_ty(cx: @CrateContext, t: ty::t, span: span) -> DIType {
486497
let dcx = dbg_cx(cx);
487498
let ty_id = ty::type_id(t);
@@ -512,7 +523,8 @@ fn create_ty(cx: @CrateContext, t: ty::t, span: span) -> DIType {
512523
}
513524
},
514525
ty::ty_enum(_did, ref _substs) => {
515-
cx.sess.span_bug(span, "debuginfo for enum NYI")
526+
cx.sess.span_note(span, "debuginfo for enum NYI");
527+
create_unimpl_ty(cx, t)
516528
}
517529
ty::ty_box(ref mt) | ty::ty_uniq(ref mt) => {
518530
let boxed = create_ty(cx, mt.ty, span);
@@ -538,18 +550,21 @@ fn create_ty(cx: @CrateContext, t: ty::t, span: span) -> DIType {
538550
create_pointer_type(cx, t, span, pointee)
539551
},
540552
ty::ty_rptr(ref _region, ref _mt) => {
541-
cx.sess.span_bug(span, "debuginfo for rptr NYI")
553+
cx.sess.span_note(span, "debuginfo for rptr NYI");
554+
create_unimpl_ty(cx, t)
542555
},
543556
ty::ty_bare_fn(ref barefnty) => {
544557
let inputs = barefnty.sig.inputs.map(|a| *a);
545558
let output = barefnty.sig.output;
546559
create_fn_ty(cx, t, inputs, output, span)
547560
},
548561
ty::ty_closure(ref _closurety) => {
549-
cx.sess.span_bug(span, "debuginfo for closure NYI")
562+
cx.sess.span_note(span, "debuginfo for closure NYI");
563+
create_unimpl_ty(cx, t)
550564
},
551565
ty::ty_trait(_did, ref _substs, ref _vstore, _) => {
552-
cx.sess.span_bug(span, "debuginfo for trait NYI")
566+
cx.sess.span_note(span, "debuginfo for trait NYI");
567+
create_unimpl_ty(cx, t)
553568
},
554569
ty::ty_struct(did, ref substs) => {
555570
let fields = ty::struct_fields(cx.tcx, did, substs);
@@ -572,7 +587,10 @@ pub fn create_local_var(bcx: block, local: @ast::local) -> DIVariable {
572587
let ident = match local.node.pat.node {
573588
ast::pat_ident(_, pth, _) => ast_util::path_to_ident(pth),
574589
// FIXME this should be handled (#2533)
575-
_ => fail!("no single variable name for local")
590+
_ => {
591+
bcx.sess().span_note(local.span, "debuginfo for pattern bindings NYI");
592+
return ptr::null();
593+
}
576594
};
577595
let name: &str = cx.sess.str_of(ident);
578596
debug!("create_local_var: %s", name);

0 commit comments

Comments
 (0)