#156824 added 32 bytes mut_restriction field to FieldDef which increased its size to 136 bytes. This might have caused a small regression in #156881 (comment)
mut_restriction, together with safety and default fields are all unstable features, so assuming they are not used very often, we might be able to get the size and perf back if we extract them out into something like Option<Box<FieldDefExtras>> and keep it None in the default case:
// before
pub struct FieldDef {
pub attrs: AttrVec,
pub id: NodeId,
pub span: Span,
pub vis: Visibility,
pub mut_restriction: MutRestriction,
pub safety: Safety,
pub ident: Option<Ident>,
pub ty: Box<Ty>,
pub default: Option<AnonConst>,
pub is_placeholder: bool,
}
//after
pub struct FieldDef {
pub attrs: AttrVec,
pub id: NodeId,
pub span: Span,
pub vis: Visibility,
pub ident: Option<Ident>,
pub extras: Option<Box<FieldDefExtras>>,
pub ty: Box<Ty>,
pub is_placeholder: bool,
}
pub struct FieldDefExtras {
pub mut_restriction: MutRestriction,
pub safety: Safety,
pub default: Option<AnonConst>,
}
#156824 added 32 bytes
mut_restrictionfield toFieldDefwhich increased its size to 136 bytes. This might have caused a small regression in #156881 (comment)mut_restriction, together withsafetyanddefaultfields are all unstable features, so assuming they are not used very often, we might be able to get the size and perf back if we extract them out into something likeOption<Box<FieldDefExtras>>and keep itNonein the default case: