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):  r? ````@oli-obk````
This commit is contained in:
commit
9e9cc66e42
4 changed files with 26 additions and 1 deletions
|
@ -456,6 +456,11 @@ impl<'tcx, Tag: Provenance> Scalar<Tag> {
|
|||
// Going through `u64` to check size and truncation.
|
||||
Ok(Double::from_bits(self.to_u64()?.into()))
|
||||
}
|
||||
|
||||
// FIXME: Replace current `impl Display for Scalar` with `impl LowerHex`.
|
||||
pub fn rustdoc_display(&self) -> String {
|
||||
if let Scalar::Int(int) = self { int.to_string() } else { self.to_string() }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Eq, PartialEq, TyEncodable, TyDecodable, HashStable, Hash)]
|
||||
|
|
|
@ -384,3 +384,10 @@ impl fmt::UpperHex for ScalarInt {
|
|||
write!(f, "{:01$X}", { self.data }, self.size as usize * 2)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for ScalarInt {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.check_data();
|
||||
write!(f, "{}", { self.data })
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue