#[fields_ty = LocFields]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
pub struct Loc {
+ pub reg_len: NonZeroU32,
pub kind: LocKind,
pub start: u32,
- pub reg_len: NonZeroU32,
}
}
pub const fn ty(self) -> Ty {
const_unwrap_res!(self.0.ty(), "Loc can only be constructed with valid fields")
}
+ /// does all `Loc` validation except checking `start`, returns the maximum
+ /// value `start` can have, so a `Loc` is valid if
+ /// `start < Loc::max_start(kind, reg_len)?`
pub const fn max_start(kind: LocKind, reg_len: NonZeroU32) -> Result<u32, Error> {
// validate Ty
const_try!(Ty::new(TyFields {