Skip to content

Concept: unstable feature #6629

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

robertbastian
Copy link
Member

@robertbastian robertbastian commented May 23, 2025

Added an unstable feature to icu_calendar.

Rendered: https://icu4x-pr-artifacts.storage.googleapis.com/gha/974b65fcb6022766f3287a17f2ee8b718e6650b5/rustdoc/icu_calendar/index.html

One thing to point out is the constructors: https://icu4x-pr-artifacts.storage.googleapis.com/gha/974b65fcb6022766f3287a17f2ee8b718e6650b5/rustdoc/icu_calendar/cal/enum.AnyCalendar.html#implementations

Semver CI expectedly breaks, as APIs that were previously only documented to be unstable are now behind the unstable feature.

@robertbastian robertbastian requested review from Manishearth, sffc and a team as code owners May 23, 2025 09:52
Copy link

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

@robertbastian robertbastian marked this pull request as draft May 23, 2025 09:55
@robertbastian robertbastian force-pushed the unstable branch 4 times, most recently from 7d010b5 to b7b7896 Compare May 23, 2025 13:38
Copy link
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally in favor of the new feature, let's discuss how this gets surfaced to the user in #6630 (review)

@robertbastian robertbastian marked this pull request as ready for review June 13, 2025 13:55
Copy link
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General design looks good!

pub trait IntoAnyCalendar: Calendar + Sized {
/// Convert this calendar into an [`AnyCalendar`], moving it
///
/// You should not need to call this method directly
#[cfg_attr(not(feature = "unstable"), doc(hidden))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: is this a breaking change? These APIs were publicly exposed even though this trait was sealed (they can be called if not used)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or, well, marking things as hidden is not a breaking change, but marking things as hidden with the understanding that they may change in the future is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In retrospect we probably should have doc(hidden)'d these methods (and those of Calendar)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I hadn't considered these functions to be unstable. I expect client code to be able to use the functions on the Calendar and IntoAnyCalendar traits in a stable way.

Copy link
Member

@Manishearth Manishearth Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not opposed to them being stable; I was mostly thinking of these as "partially internal" where they could go either way. I've definitely had use for IntoAnyCalendar.

"Can be called but not implemented" is a valid use of sealed traits.

@@ -26,14 +26,17 @@ use core::fmt;
/// </div>
pub trait Calendar: crate::cal::scaffold::UnstableSealed {
/// The internal type used to represent dates
#[cfg_attr(not(feature = "unstable"), doc(hidden))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: ditto on stability here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not currently convinced that the types and methods on Date should be marked unstable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please comment on the APIs you're referring to

/// 🚧 This method is considered unstable; it may change at any time, in breaking or non-breaking ways,
/// including in SemVer minor releases. This requires the `unstable` Cargo feature.
/// </div>
#[cfg(feature = "unstable")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: yay, hidden replaced by a feature, always good to see

Comment on lines 652 to +658
#[doc = icu_provider::gen_buffer_unstable_docs!(UNSTABLE, Self::new)]
///
/// <div class="stab unstable">
/// 🚧 This method is considered unstable; it may change at any time, in breaking or non-breaking ways,
/// including in SemVer minor releases. This requires the `unstable` Cargo feature.
/// </div>
#[cfg_attr(not(feature = "unstable"), doc(hidden))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion, here and elsewhere: should the warning go inside gen_buffer_unstable_docs?

Copy link
Member Author

@robertbastian robertbastian Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eventually, but only once I added the feature to all crates

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make it #[doc = icu_provider::gen_buffer_unstable_docs!(UNSTABLE_WITH_FEATURE, Self::new)] to reduce churn later

pub trait IntoAnyCalendar: Calendar + Sized {
/// Convert this calendar into an [`AnyCalendar`], moving it
///
/// You should not need to call this method directly
#[cfg_attr(not(feature = "unstable"), doc(hidden))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I hadn't considered these functions to be unstable. I expect client code to be able to use the functions on the Calendar and IntoAnyCalendar traits in a stable way.

Comment on lines 41 to 43
/// Internal scaffolding types
#[cfg_attr(not(feature = "unstable"), doc(hidden))]
pub mod scaffold {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought: Types in scaffold are not unstable in the same way as types in provider; it is still safe to make bounds based on them. Discuss?

In this particular instance, UnstableSealed is good to tag in this way, but maybe not the whole module?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

  • UnstableSealed should be feature-gated
  • The traits themselves should be always-public: people will need them for bounds
  • The trait methods should be feature-hidden

@@ -26,14 +26,17 @@ use core::fmt;
/// </div>
pub trait Calendar: crate::cal::scaffold::UnstableSealed {
/// The internal type used to represent dates
#[cfg_attr(not(feature = "unstable"), doc(hidden))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not currently convinced that the types and methods on Date should be marked unstable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants