Skip to content

Commit e291234

Browse files
committed
Pretty-print uninhabited const values more explicitly.
1 parent 47ab5f7 commit e291234

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
@@ -1218,8 +1218,15 @@ pub trait PrettyPrinter<'tcx>:
12181218
}
12191219
p!(")");
12201220
}
1221-
ty::Adt(def, substs) if def.variants.is_empty() => {
1222-
p!(print_value_path(def.did, substs));
1221+
ty::Adt(def, _) if def.variants.is_empty() => {
1222+
self = self.typed_value(
1223+
|mut this| {
1224+
write!(this, "unreachable()")?;
1225+
Ok(this)
1226+
},
1227+
|this| this.print_type(ty),
1228+
": ",
1229+
)?;
12231230
}
12241231
ty::Adt(def, substs) => {
12251232
let variant_id =

0 commit comments

Comments
 (0)