actually print out non local anon consts

This commit is contained in:
Boxy 2023-01-14 19:03:50 +00:00
parent 88f81a0de1
commit a2a50f96f3
2 changed files with 5 additions and 5 deletions
compiler/rustc_middle/src/ty/print
tests/ui/const-generics/generic_const_exprs

@ -1295,10 +1295,10 @@ pub trait PrettyPrinter<'tcx>:
if let Ok(snip) = self.tcx().sess.source_map().span_to_snippet(span) {
p!(write("{}", snip))
} else {
print_underscore!()
p!(print_value_path(def.did, substs))
}
} else {
print_underscore!()
p!(print_value_path(def.did, substs))
}
}
defkind => bug!("`{:?}` has unexpcted defkind {:?}", ct, defkind),
@ -1323,7 +1323,7 @@ pub trait PrettyPrinter<'tcx>:
ty::ConstKind::Placeholder(placeholder) => p!(write("Placeholder({:?})", placeholder)),
// FIXME(generic_const_exprs):
// write out some legible representation of an abstract const?
ty::ConstKind::Expr(_) => p!("[Const Expr]"),
ty::ConstKind::Expr(_) => p!("[const expr]"),
ty::ConstKind::Error(_) => p!("[const error]"),
};
Ok(self)

@ -2,10 +2,10 @@ error[E0308]: mismatched types
--> $DIR/non_local_anon_const_diagnostics.rs:12:43
|
LL | let _: anon_const_non_local::Foo<2> = anon_const_non_local::foo::<M>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `2`, found `_`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `2`, found `foo::<M>::{constant#0}`
|
= note: expected constant `2`
found constant `_`
found constant `foo::<M>::{constant#0}`
error: aborting due to previous error