]> git.lizzy.rs Git - rust.git/commitdiff
Pretty-print uninhabited const values more explicitly.
authorEduard-Mihai Burtescu <eddyb@lyken.rs>
Fri, 16 Jul 2021 11:12:18 +0000 (14:12 +0300)
committerEduard-Mihai Burtescu <eddyb@lyken.rs>
Tue, 24 Aug 2021 16:07:50 +0000 (19:07 +0300)
compiler/rustc_middle/src/ty/print/pretty.rs

index 8558d6bb00e724a79dbf9cde7985a7a3aac5e538..36d4116f846488e7fdd8881a8d1e4cfdc427dbfe 100644 (file)
@@ -1218,8 +1218,15 @@ fn pretty_print_const_value(
                         }
                         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 =