about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <eddyb@lyken.rs>2021-07-16 14:12:18 +0300
committerEduard-Mihai Burtescu <eddyb@lyken.rs>2021-08-24 19:07:50 +0300
commite291234f59523f57106a233d3115958ded7d3b04 (patch)
tree271997655c2eae75031e165f2cef5ef1e72160d8
parent47ab5f7ce27397310bd8359b8db1504fbf8a9b59 (diff)
downloadrust-e291234f59523f57106a233d3115958ded7d3b04.tar.gz
rust-e291234f59523f57106a233d3115958ded7d3b04.zip
Pretty-print uninhabited const values more explicitly.
-rw-r--r--compiler/rustc_middle/src/ty/print/pretty.rs11
1 files 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 =