diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-04-17 17:29:38 +0200 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-05-25 10:07:01 +0200 |
| commit | db652fcde4bfea48150ec54b315dd104ae0f4b59 (patch) | |
| tree | 34e8db717d1afa55d705a89dc1fc9b27882c4f8e /src | |
| parent | 669bc7788667db2fc113e4ba2ab3bdc2119665f6 (diff) | |
| download | rust-db652fcde4bfea48150ec54b315dd104ae0f4b59.tar.gz rust-db652fcde4bfea48150ec54b315dd104ae0f4b59.zip | |
Render unresolved anon consts like closures
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/ty/print/pretty.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/librustc/ty/print/pretty.rs b/src/librustc/ty/print/pretty.rs index 95b1519023f..f16208503fe 100644 --- a/src/librustc/ty/print/pretty.rs +++ b/src/librustc/ty/print/pretty.rs @@ -1,5 +1,5 @@ use crate::hir; -use crate::hir::def::Namespace; +use crate::hir::def::{Namespace, Def}; use crate::hir::map::{DefPathData, DisambiguatedDefPathData}; use crate::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use crate::middle::cstore::{ExternCrate, ExternCrateSource}; @@ -1540,9 +1540,15 @@ define_print_and_forward_display! { &'tcx ty::Const<'tcx> { let u8 = cx.tcx().types.u8; match (self.val, &self.ty.sty) { - | (ConstValue::Unevaluated(..), _) - | (ConstValue::Infer(..), _) - => p!(write("_: "), print(self.ty)), + (ConstValue::Unevaluated(did, substs), _) => { + match cx.tcx().describe_def(did) { + | Some(Def::Static(_, _)) + | Some(Def::Const(_)) + | Some(Def::AssociatedConst(_)) => p!(write("{}", cx.tcx().def_path_str(did))), + _ => p!(write("_")), + } + } + (ConstValue::Infer(..), _) => p!(write("_: "), print(self.ty)), (ConstValue::Param(ParamConst { name, .. }), _) => p!(write("{}", name)), (ConstValue::Scalar(Scalar::Bits { bits: 0, .. }), ty::Bool) => p!(write("false")), (ConstValue::Scalar(Scalar::Bits { bits: 1, .. }), ty::Bool) => p!(write("true")), |
