Skip to content
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

stable/unstable/nightly-only features #10881

Open
ehuss opened this issue Jul 19, 2022 · 3 comments
Open

stable/unstable/nightly-only features #10881

ehuss opened this issue Jul 19, 2022 · 3 comments
Labels
A-features Area: features — conditional compilation C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-rfc Status: Needs an RFC to make progress.

Comments

@ehuss
Copy link
Contributor

ehuss commented Jul 19, 2022

Some packages have features that they intend to be "unstable" in that they enable functionality that may change over time, or may even be removed. Closely related to this are features that enable nightly-only functionality (see nightly-only features). I'm not sure if these two are distinct enough to consider separately, though they seem pretty similar to me.

Currently the documentation just recommends clearly documenting which features are unstable. However, that does not provide very good assurances that users know what they are opting into.

I don't know what would be a good way to make it clear that one is opting into an unstable feature. Another consideration is to possibly deny the use of unstable features.

Possible syntax may look like:

[features.foobar]
unstable = true

One thing to consider is the possible confusion of the term "unstable features" with Cargo's own Unstable Features. I'm not sure what terminology would be best here.

I'm opening this issue to track this feature request, but this isn't something we will likely pursue in the near term. This will require an RFC to explore the design in more detail.

See also:

@Pr0methean
Copy link

I'd suggest that the definition of such a feature also be able to include a rust-version that's either nightly or a later stable version than the crate's rust-version, so that unstable features can use newer/unstable compiler features and the source of any incompatibility will be clear to the user.

@epage
Copy link
Contributor

epage commented May 23, 2023

Some packages have features that they intend to be "unstable" in that they enable functionality that may change over time, or may even be removed. Closely related to this are features that enable nightly-only functionality (see nightly-only features). I'm not sure if these two are distinct enough to consider separately, though they seem pretty similar to me.

Potentially tying in rust-version to nightly features I think highlights a potential distinctive need between nightly and unstable features.

In rust-lang/rfcs#3416, my proposal for unstable is that its viral (can only be used by other unstable features) but not much other special functionality.

One idea for how we could act on unstable if we move forward with it in this RFC:

  • unstable features may only be required by other unstable features or by the command-line

    • Since unstable features are not subject to semver, they may be removed, so any non-existent features that an unstable feature requires produces a warning at most unless the unstable feature is activated, then it errors (no idea how complicated this would be)
  • Future possibility: unstable features may also be required when the version requirement is =<x>.<y>.<z>

@epage
Copy link
Contributor

epage commented Jun 12, 2023

It might also be nice to have any field to mirror the unstable #[stable] attribute

@epage epage added the S-needs-rfc Status: Needs an RFC to make progress. label Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-features Area: features — conditional compilation C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-rfc Status: Needs an RFC to make progress.
Projects
None yet
Development

No branches or pull requests

3 participants