Do not expose fallible to_int operation on Scalar.

Any use of it has been shown to be a bug in the past.
This commit is contained in:
Oli Scherer 2021-03-15 12:06:07 +00:00
parent 0dd5a1b622
commit 9f407ae5ee
3 changed files with 17 additions and 19 deletions

View file

@ -2473,7 +2473,7 @@ impl ConstantKind<'tcx> {
#[inline]
pub fn try_to_scalar_int(self) -> Option<ScalarInt> {
self.try_to_value()?.try_to_scalar()?.to_int().ok()
Some(self.try_to_value()?.try_to_scalar()?.assert_int())
}
#[inline]