-
Notifications
You must be signed in to change notification settings - Fork 224
Gate Rules-helpers on unstable #7094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
According to unicode-org#6659 (comment), all experimental APIs should be *gated* (not hidden) on unstable. We have not yet implemented the plan in that PR, but we should try to follow it for new things behind the unstable feature. unicode-org#7092 put `Rules` behind the unstable feature, but it made it `doc(hidden)`. For `Rules` specifically, it needs to be `doc(hidden)` since datetime uses it, but the other types should be fully gated. This PR fully gates the YearInfo types, and makes Rules narrowly doc(hidden). It also adds additional docs that explain the unstableness of the parameters on LunarChinese and Hijri since the trait docs will not be visible when the feature is disabled
Co-authored-by: Robert Bastian <[email protected]>
25f9223
to
e723520
Compare
I would like to review this tomorrow, there are a lot of changes here |
Sure. I put the cross-crate import behind hidden This plan was somewhat sketched out in #6659 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm happy with this for 2.1 purposes. @robertbastian wants to review again.
impl UnstableSealed for Hebrew {} | ||
impl UnstableSealed for Indian {} | ||
impl<R: hijri::Rules> UnstableSealed for Hijri<R> {} | ||
impl<R: hijri::unstable_internal::Rules> UnstableSealed for Hijri<R> {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: I think this can bind on FormattableHijriRules
, and then we have only 1 user of the calendar trait in the datetime crate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be cyclic, yes? FHR depends on UnstableSealed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also adds additional docs that explain the unstableness of the parameters on LunarChinese and Hijri since the trait docs will not be visible when the feature is disabled
in #6659 we decided that the unstable feature would be enabled on docs.rs, so I don't see the necessity of this. in fact, if you build local docs with the actual features you have enabled you shouldn't need to know this. I don't want to set a precedent for explaining unstable APIs on other APIs because of the possibility that someone builds docs locally without the unstable feature
#[doc(hidden)] | ||
/// These are unstable traits but we expose them on stable to | ||
/// icu_datetime. | ||
pub mod unstable_internal { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a fan of unstable modules, and I don't think we have agreed on doing this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What we agreed on doing was gating these.
We're not doing that here: we're conditionally-doc(hidden)
ing them, because we have to.
We have not agreed on a route to take for this case. The route proposed here seems okay and easy to change in the future.
My justification for this route is that a conditional doc(hidden)
will still show up on docs.rs, which means people may use it without enabling the unstable feature. This module means that if people wish to use the thing on docs.rs they must explicitly opt in to the unstable feature, and internally we use a different, secret path that is very clearly unstable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok the route proposed here seems okay and I guess because it's unstable we can change it at any time
Yes, you should: With local docs, you will see an unlinked |
56d5367
to
d0bfc1d
Compare
Merging based on Robert's review and Shane's earlier statement. Nothing in this PR is irreversible, anyway. |
I want to do more unstable-gating work on traits here but I think it will clash with error handling. |
According to
#6659 (comment), all experimental APIs should be gated (not hidden) on unstable. We have not yet implemented the plan in that PR, but we should try to follow it for new things behind the unstable feature.
#7092 put
Rules
behind the unstable feature, but it made itdoc(hidden)
. ForRules
specifically, it needs to bedoc(hidden)
since datetime uses it, but the other types should be fully gated.This PR fully gates the YearInfo types, and makes Rules narrowly doc(hidden). It also adds additional docs that explain the unstableness of the parameters on LunarChinese and Hijri since the trait docs will not be visible when the feature is disabled