Skip to content

Stabilize #![feature(staged_api)] #79663

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
GuillaumeGomez opened this issue Dec 3, 2020 · 11 comments
Open

Stabilize #![feature(staged_api)] #79663

GuillaumeGomez opened this issue Dec 3, 2020 · 11 comments
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-feature-request Category: A feature request, i.e: not implemented / a PR. needs-rfc This change is large or controversial enough that it should have an RFC accepted before doing it. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Dec 3, 2020

The idea behind it is to allow users to mark items as not yet stable for their crates, allowing them to change it without requiring to make a new major release. It'll will require a few changes though. Currently, the unstable attribute looks like this:

#[unstable(feature = "some_feature", reason = "some reason", issue = "123")]

So here is what I suggest:

  • Enforce feature only for rustc.
  • Force issue to have a full URL outside of rustc (maybe even inside?).
  • Keep reason, I think it's fine to have a reason.

Once this done, rustdoc would also need to make some updates:

  • If unstable is used on a module, all its children (and children of its children recursively) should say that a parent is unstable and therefore this item is unstable too (which is message like a parent of _child_ is unstable, therefore _child_ is unstable too). This message should be put at the top of the item page and not repeated on any of the element of the page to prevent adding unnecessary noise.
  • If both a parent and the item are unstable, only display the message of the item.
  • If two parents are unstable, only print message of the closest one.

What do you think?

cc @rust-lang/compiler @rust-lang/rustdoc @RDambrosio016

@GuillaumeGomez GuillaumeGomez added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-rustdoc-ui Area: Rustdoc UI (generated HTML) labels Dec 3, 2020
@jonas-schievink jonas-schievink added the needs-rfc This change is large or controversial enough that it should have an RFC accepted before doing it. label Dec 3, 2020
@Mark-Simulacrum
Copy link
Member

This seems like it would not really be a T-compiler/T-rustdoc issue, but rather a proposal to stabilize a subset of the staged_api feature. I think this would be significant enough that we'd want an RFC, likely T-lang, and probably a project group to focus on identifying the problems to solve / solution space before trying to propose a specific solution.

@RDambrosio016
Copy link
Contributor

It may be very helpful to allow users to specify a custom message for the text shown in the rustdoc docs instead of always using "this item/struct is unstable and subject to change"

@bjorn3
Copy link
Member

bjorn3 commented Dec 3, 2020

What about also requiring #![feature] for these, but simply allowing it to be used on stable?

@jyn514
Copy link
Member

jyn514 commented Dec 3, 2020

I think discussion about this should be a pre-RFC on internals or a full-blown RFC, both of which have better tools for interleaved conversations. Probably a pre-RFC since it sounds like staged_api shouldn't be stabilized as-is.

@poliorcetics
Copy link
Contributor

That sounds like a really nice feature. I agree it needs some design though.

@jyn514 jyn514 changed the title Allow to use #[unstable(...)] outside of rustc and improve rustdoc imlementation Stabilize #![feature(staged_api)] Dec 15, 2020
@Cldfire
Copy link
Contributor

Cldfire commented Jan 6, 2021

It would be very hepful for this attribute to support linking to the issue specified (inspired by the Rust Search Extension):

Image

Screen Shot 2021-01-06 at 3 00 37 PM

This would probably require a way to globally specify a root issue URL for a given crate.

EDIT: ah, the original issue description mentions Force issue to have a full URL outside of rustc (maybe even inside?)., so consider this comment added context to that 😄

@Nemo157
Copy link
Member

Nemo157 commented Jan 6, 2021

Pre-emptively, I would like it if the URL is not required to be an http(s) one. As an example of current non-http issue URLs there is Apple's radr:// scheme, and I think there is a decent chance of decentralized/federated/p2p project management solutions using custom schemes becoming popular enough within the next few years.

@camelid camelid added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Dec 15, 2021
@Ezrashaw
Copy link
Contributor

Ezrashaw commented Jan 8, 2023

Hmm, I wonder if this shouldn't use the existing #[stable(...)] and #[unstable(...)], perhaps a new feature should be implemented. The behavior intended seems subtly different from the current use of those attributes.

On another note, (I assume you mean stdlib as well as rustc)

  • Enforce feature only for rustc.

  • Force issue to have a full URL outside of rustc (maybe even inside?).

  • Keep reason, I think it's fine to have a reason.

How do you intend to determine if the currently compiling code is stdlib or rustc? Currently this is the way to know, and (AFAIK) there is no other good replacement.

@jhpratt
Copy link
Member

jhpratt commented Jan 8, 2023

Huh, apparently I subscribed to this issue at some point, yet I don't recall ever having seen it.

To put it bluntly: I strongly oppose stabilizing #![feature(staged_api)] in its current form. It is a massive change that has not gone through the RFC process. I hope to have some design work laid out in the near-ish future, with the intent being that said work lays the basis for a formal RFC. I already have it in my head; I need to write it down.

@Ezrashaw
Copy link
Contributor

Ezrashaw commented Jan 8, 2023

Yes, there was some discussion on discord about this as well. Everyone recognizes the need for a RFC, this is a kind of pre-RFC (I don't think OP realized that an RFC was needed).

@GuillaumeGomez
Copy link
Member Author

No, even at the time it was something I was targetting. I just wasn't sure if the discussion about it should happen on the RFC or on the issue first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-feature-request Category: A feature request, i.e: not implemented / a PR. needs-rfc This change is large or controversial enough that it should have an RFC accepted before doing it. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests