Skip to content

Commit 5038fae

Browse files
eddybtmiasko
authored andcommitted
Pretty-print uninhabited const values more explicitly.
1 parent c49895d commit 5038fae

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,8 +1217,15 @@ pub trait PrettyPrinter<'tcx>:
12171217
}
12181218
p!(")");
12191219
}
1220-
ty::Adt(def, substs) if def.variants.is_empty() => {
1221-
p!(print_value_path(def.did, substs));
1220+
ty::Adt(def, _) if def.variants.is_empty() => {
1221+
self = self.typed_value(
1222+
|mut this| {
1223+
write!(this, "unreachable()")?;
1224+
Ok(this)
1225+
},
1226+
|this| this.print_type(ty),
1227+
": ",
1228+
)?;
12221229
}
12231230
ty::Adt(def, substs) => {
12241231
let variant_id =

0 commit comments

Comments
 (0)