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

inherit stable annotations in enum variants and field items #370

Closed
3 tasks done
nikomatsakis opened this issue Oct 14, 2020 · 8 comments
Closed
3 tasks done

inherit stable annotations in enum variants and field items #370

nikomatsakis opened this issue Oct 14, 2020 · 8 comments
Labels
disposition-merge The FCP starter wants to merge this finished-final-comment-period The FCP has finished, action upon the disposition label needs to be taken major-change A proposal to make a major change to rustc major-change-accepted A major change proposal that was accepted T-compiler Add this label so rfcbot knows to poll the compiler team

Comments

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Oct 14, 2020

Proposal

Some time back, @estebank opened rust-lang/rust#71481 which proposed to fix rust-lang/rust#65515 by allowing stability attributes to be 'inherited'. The idea is that if you declare a struct/enum to be stable, then you are also declaring (by default) all of its public fields to be stable.

The primary motivation for the change is diagnostics. In our error messages, we sometimes print type declarations by excerpting from the source, and those currently contain various stability attributes that distract the user.

This change also reduces the annotation burden. As @estebank argues in #65515, it is quite unusual to have a stable struct/enum with public fields that are unstable (although I've not tried to verify this by inspection). In #65515, @alexcrichton commented:

I think we've never had a case for public enums and private variants [..] so removing all the internal attributes should be fine.

@dtolnay commented, and @SimonSapin concurred:

Removing #[stable] from public enum variants and their fields both seem good to me. This isn't something we would need right away but what would make sense to me is if public elements of an item (its variants and fields) inherit #[stable] from the item, with explicit #[unstable] to negate that behavior.

The main downside is that if we DO have a struct that is stabilized, but we do not wish to stabilize its public fields, we have to remember to explicitly annotate those fields as UNSTABLE, as @nagisa pointed out.

Based on the above comments I believe the change makes sense, both for error messages and to reduce annotation burden.

Mentors or Reviewers

@estebank has already prepared the PR

Process

The main points of the Major Change Process is as follows:

  • File an issue describing the proposal.
  • A compiler team member or contributor who is knowledgeable in the area can second by writing @rustbot second.
    • Finding a "second" suffices for internal changes. If however you are proposing a new public-facing feature, such as a -C flag, then full team check-off is required.
    • Compiler team members can initiate a check-off via @rfcbot fcp merge on either the MCP or the PR.
  • Once an MCP is seconded, the Final Comment Period begins. If no objections are raised after 10 days, the MCP is considered approved.

You can read more about Major Change Proposals on forge.

Comments

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

@nikomatsakis nikomatsakis added T-compiler Add this label so rfcbot knows to poll the compiler team major-change A proposal to make a major change to rustc labels Oct 14, 2020
@rustbot
Copy link
Collaborator

rustbot commented Oct 14, 2020

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

@rustbot rustbot added the to-announce Announce this issue on triage meeting label Oct 14, 2020
@nikomatsakis
Copy link
Contributor Author

@rustbot second

@rustbot rustbot added the final-comment-period The FCP has started, most (if not all) team members are in agreement label Oct 14, 2020
@pnkfelix
Copy link
Member

Discussed at T-compiler meeting; we're going to put this through a full FCP process rather than the MCP seconding process.

@rfcbot fcp merge

@rfcbot
Copy link
Collaborator

rfcbot commented Oct 15, 2020

Team member @pnkfelix has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period An FCP has been started, cast your votes and raise concerns disposition-merge The FCP starter wants to merge this labels Oct 15, 2020
@nikomatsakis nikomatsakis added disposition-merge The FCP starter wants to merge this proposed-final-comment-period An FCP has been started, cast your votes and raise concerns and removed disposition-merge The FCP starter wants to merge this final-comment-period The FCP has started, most (if not all) team members are in agreement proposed-final-comment-period An FCP has been started, cast your votes and raise concerns labels Oct 15, 2020
@spastorino spastorino removed the to-announce Announce this issue on triage meeting label Oct 15, 2020
@nagisa
Copy link
Member

nagisa commented Oct 24, 2020

@rfcbot reviewed

I still think libstd is in a position where additional care regarding stability of its APIs warrants the annotation burden, but I don't have much reason to block this.

@rfcbot
Copy link
Collaborator

rfcbot commented Oct 24, 2020

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot added final-comment-period The FCP has started, most (if not all) team members are in agreement and removed proposed-final-comment-period An FCP has been started, cast your votes and raise concerns labels Oct 24, 2020
@rfcbot rfcbot added finished-final-comment-period The FCP has finished, action upon the disposition label needs to be taken and removed final-comment-period The FCP has started, most (if not all) team members are in agreement labels Nov 3, 2020
@rfcbot
Copy link
Collaborator

rfcbot commented Nov 3, 2020

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

The RFC will be merged soon.

@rfcbot rfcbot added the to-announce Announce this issue on triage meeting label Nov 3, 2020
@nikomatsakis nikomatsakis added the major-change-accepted A major change proposal that was accepted label Nov 5, 2020
@nikomatsakis
Copy link
Contributor Author

Closing as accepted. The PR is rust-lang/rust#71481

@spastorino spastorino removed the to-announce Announce this issue on triage meeting label Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge The FCP starter wants to merge this finished-final-comment-period The FCP has finished, action upon the disposition label needs to be taken major-change A proposal to make a major change to rustc major-change-accepted A major change proposal that was accepted T-compiler Add this label so rfcbot knows to poll the compiler team
Projects
None yet
Development

No branches or pull requests

6 participants