Make unevaluated DefId rendering deterministic

This commit is contained in:
Oli Scherer 2021-03-29 16:35:21 +00:00
parent 5582b19559
commit 1d56b8a2bc
20 changed files with 37 additions and 23 deletions

View file

@ -465,7 +465,21 @@ impl Visitor<'tcx> for ExtraComments<'tcx> {
if use_verbose(ty) {
self.push("ty::Const");
self.push(&format!("+ ty: {:?}", ty));
self.push(&format!("+ val: {:?}", val));
let val = match val {
ty::ConstKind::Param(p) => format!("Param({})", p),
ty::ConstKind::Infer(infer) => format!("Infer({:?})", infer),
ty::ConstKind::Bound(idx, var) => format!("Bound({:?}, {:?})", idx, var),
ty::ConstKind::Placeholder(ph) => format!("PlaceHolder({:?})", ph),
ty::ConstKind::Unevaluated(uv) => format!(
"Unevaluated({}, {:?}, {:?})",
self.tcx.def_path_str(uv.def.did),
uv.substs,
uv.promoted
),
ty::ConstKind::Value(val) => format!("Value({:?})", val),
ty::ConstKind::Error(_) => format!("Error"),
};
self.push(&format!("+ val: {}", val));
}
}