1
Fork 0

Rollup merge of #94091 - GuillaumeGomez:rustdoc-const-computed-value, r=oli-obk

Fix rustdoc const computed value

Fixes #85088.

It looks like this now (instead of hexadecimal):

![Screenshot from 2022-02-17 17-55-39](https://user-images.githubusercontent.com/3050060/154532115-0f9861a0-406f-4c9c-957f-32bedd8aca7d.png)

r? ````@oli-obk````
This commit is contained in:
Matthias Krüger 2022-02-20 00:37:27 +01:00 committed by GitHub
commit 9e9cc66e42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 1 deletions

View file

@ -302,7 +302,11 @@ fn print_const_with_custom_print_scalar(tcx: TyCtxt<'_>, ct: ty::Const<'_>) -> S
// For all other types, fallback to the original `pretty_print_const`.
match (ct.val(), ct.ty().kind()) {
(ty::ConstKind::Value(ConstValue::Scalar(int)), ty::Uint(ui)) => {
format!("{}{}", format_integer_with_underscore_sep(&int.to_string()), ui.name_str())
format!(
"{}{}",
format_integer_with_underscore_sep(&int.rustdoc_display()),
ui.name_str()
)
}
(ty::ConstKind::Value(ConstValue::Scalar(int)), ty::Int(i)) => {
let ty = tcx.lift(ct.ty()).unwrap();