diff options
| author | Ariel Ben-Yehuda <ariel.byd@gmail.com> | 2018-12-04 13:28:06 +0200 |
|---|---|---|
| committer | Ariel Ben-Yehuda <ariel.byd@gmail.com> | 2019-01-04 00:34:52 +0200 |
| commit | 3aa1503a61d03834643a39f3e4c9de6721c31bdb (patch) | |
| tree | ad29fd4d3b5ad4854523a501fa94568e3536b524 /src/librustc_codegen_llvm/debuginfo | |
| parent | c0bbc3927e28c22edefe6a1353b5ecc95ea9a104 (diff) | |
| download | rust-3aa1503a61d03834643a39f3e4c9de6721c31bdb.tar.gz rust-3aa1503a61d03834643a39f3e4c9de6721c31bdb.zip | |
add support for principal-less trait object types
should be a pure refactoring.
Diffstat (limited to 'src/librustc_codegen_llvm/debuginfo')
| -rw-r--r-- | src/librustc_codegen_llvm/debuginfo/metadata.rs | 3 | ||||
| -rw-r--r-- | src/librustc_codegen_llvm/debuginfo/type_names.rs | 16 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index 0fd04e9d203..72ed55df946 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -429,7 +429,8 @@ fn trait_pointer_metadata( // But it does not describe the trait's methods. let containing_scope = match trait_type.sty { - ty::Dynamic(ref data, ..) => Some(get_namespace_for_item(cx, data.principal().def_id())), + ty::Dynamic(ref data, ..) => + data.principal_def_id().map(|did| get_namespace_for_item(cx, did)), _ => { bug!("debuginfo: Unexpected trait-object type in \ trait_pointer_metadata(): {:?}", diff --git a/src/librustc_codegen_llvm/debuginfo/type_names.rs b/src/librustc_codegen_llvm/debuginfo/type_names.rs index c8cbd735e85..32432f7e4ec 100644 --- a/src/librustc_codegen_llvm/debuginfo/type_names.rs +++ b/src/librustc_codegen_llvm/debuginfo/type_names.rs @@ -107,12 +107,16 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, } }, ty::Dynamic(ref trait_data, ..) => { - let principal = cx.tcx.normalize_erasing_late_bound_regions( - ty::ParamEnv::reveal_all(), - &trait_data.principal(), - ); - push_item_name(cx, principal.def_id, false, output); - push_type_params(cx, principal.substs, output); + if let Some(principal) = trait_data.principal() { + let principal = cx.tcx.normalize_erasing_late_bound_regions( + ty::ParamEnv::reveal_all(), + &principal, + ); + push_item_name(cx, principal.def_id, false, output); + push_type_params(cx, principal.substs, output); + } else { + output.push_str("dyn '_"); + } }, ty::FnDef(..) | ty::FnPtr(_) => { let sig = t.fn_sig(cx.tcx); |
