From e291234f59523f57106a233d3115958ded7d3b04 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Fri, 16 Jul 2021 14:12:18 +0300 Subject: [PATCH] Pretty-print uninhabited const values more explicitly. --- compiler/rustc_middle/src/ty/print/pretty.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 8558d6bb00e..36d4116f846 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -1218,8 +1218,15 @@ pub trait PrettyPrinter<'tcx>: } p!(")"); } - ty::Adt(def, substs) if def.variants.is_empty() => { - p!(print_value_path(def.did, substs)); + ty::Adt(def, _) if def.variants.is_empty() => { + self = self.typed_value( + |mut this| { + write!(this, "unreachable()")?; + Ok(this) + }, + |this| this.print_type(ty), + ": ", + )?; } ty::Adt(def, substs) => { let variant_id =