-
Notifications
You must be signed in to change notification settings - Fork 214
Open
Labels
C-zerovecComponent: Yoke, ZeroVec, DataBakeComponent: Yoke, ZeroVec, DataBakeS-smallSize: One afternoon (small bug fix or enhancement)Size: One afternoon (small bug fix or enhancement)T-bugType: Bad behavior, security, privacyType: Bad behavior, security, privacy
Milestone
Description
Consider the following struct, which exists in ICU4X:
pub struct Region(TinyAsciiStr<REGION_NUM_LENGTH>);
To make this into a ULE, it is tempting to simply apply #[derive(ULE)]
. However, this is unsafe, because it enables the creation of Region
instances that are not valid region subtags.
This footgun is shared with #[derive(Deserialize)]
, as we discuss at length in #1290.
To fix this, I propose that we:
- By default, require that fields are
pub
when#[derive(ULE)]
is applied - Allow a user to opt out of this behavior with something like
#[zerovec::allow_private(reason = "...")]
Metadata
Metadata
Assignees
Labels
C-zerovecComponent: Yoke, ZeroVec, DataBakeComponent: Yoke, ZeroVec, DataBakeS-smallSize: One afternoon (small bug fix or enhancement)Size: One afternoon (small bug fix or enhancement)T-bugType: Bad behavior, security, privacyType: Bad behavior, security, privacy