Only expect mono consts in CFI

This commit is contained in:
Michael Goulet
2024-09-20 20:10:06 -04:00
parent d3f270b542
commit c0d1a1305d
2 changed files with 6 additions and 2 deletions

View File

@@ -521,6 +521,10 @@ impl<'tcx> Const<'tcx> {
self.try_to_valtree()?.try_to_scalar()
}
pub fn try_to_bool(self) -> Option<bool> {
self.try_to_scalar()?.to_bool().ok()
}
#[inline]
pub fn try_to_target_usize(self, tcx: TyCtxt<'tcx>) -> Option<u64> {
self.try_to_valtree()?.try_to_target_usize(tcx)