Trait rustc_middle::ty::layout::IntegerExt
source · pub trait IntegerExt {
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>, signed: bool) -> Ty<'tcx>;
fn from_int_ty<C: HasDataLayout>(cx: &C, ity: IntTy) -> Integer;
fn from_uint_ty<C: HasDataLayout>(cx: &C, uty: UintTy) -> Integer;
fn repr_discr<'tcx>(
tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>,
repr: &ReprOptions,
min: i128,
max: i128
) -> (Integer, bool);
}
Required Methods§
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>, signed: bool) -> Ty<'tcx>
fn from_int_ty<C: HasDataLayout>(cx: &C, ity: IntTy) -> Integer
fn from_uint_ty<C: HasDataLayout>(cx: &C, uty: UintTy) -> Integer
fn repr_discr<'tcx>(
tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>,
repr: &ReprOptions,
min: i128,
max: i128
) -> (Integer, bool)
Implementations on Foreign Types§
source§impl IntegerExt for Integer
impl IntegerExt for Integer
source§fn repr_discr<'tcx>(
tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>,
repr: &ReprOptions,
min: i128,
max: i128
) -> (Integer, bool)
fn repr_discr<'tcx>(
tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>,
repr: &ReprOptions,
min: i128,
max: i128
) -> (Integer, bool)
Finds the appropriate Integer type and signedness for the given
signed discriminant range and #[repr]
attribute.
N.B.: u128
values above i128::MAX
will be treated as signed, but
that shouldn’t affect anything, other than maybe debuginfo.