1 use rustc_middle
::ty
::{self, IntTy, Ty, TyCtxt, UintTy}
;
3 /// Returns the size in bits of an integral type.
4 /// Will return 0 if the type is not an int or uint variant
5 pub(super) fn int_ty_to_nbits(typ
: Ty
<'_
>, tcx
: TyCtxt
<'_
>) -> u64 {
7 ty
::Int(i
) => match i
{
8 IntTy
::Isize
=> tcx
.data_layout
.pointer_size
.bits(),
15 ty
::Uint(i
) => match i
{
16 UintTy
::Usize
=> tcx
.data_layout
.pointer_size
.bits(),