1
Fork 0

Auto merge of #115612 - cjgillot:const-prop-int, r=oli-obk

Improvements to dataflow const-prop

Partially cherry-picked from https://github.com/rust-lang/rust/pull/110719

r? `@oli-obk`
cc `@jachris`
This commit is contained in:
bors 2023-09-08 15:32:54 +00:00
commit 3cd97ed3c3
63 changed files with 1978 additions and 187 deletions

View file

@ -1737,6 +1737,13 @@ impl<'tcx> PlaceRef<'tcx> {
}
}
impl From<Local> for PlaceRef<'_> {
#[inline]
fn from(local: Local) -> Self {
PlaceRef { local, projection: &[] }
}
}
impl Debug for Place<'_> {
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
self.as_ref().fmt(fmt)
@ -2317,7 +2324,7 @@ impl<'tcx> ConstantKind<'tcx> {
#[inline]
pub fn try_to_scalar_int(self) -> Option<ScalarInt> {
Some(self.try_to_scalar()?.assert_int())
self.try_to_scalar()?.try_to_int().ok()
}
#[inline]