|
| 1 | +# Implement restrictions, prepare for stabilization |
| 2 | + |
| 3 | +| Metadata | | |
| 4 | +| -------- | -------- | |
| 5 | +| Owner(s) | @jhpratt | |
| 6 | +| Teams | [lang] | |
| 7 | +| Status | Proposed | |
| 8 | + |
| 9 | +[rfc]: https://rust-lang.github.io/rfcs/3323-restrictions.html |
| 10 | +[pr]: https://github.com/rust-lang/rust/pull/106074 |
| 11 | + |
| 12 | +## Summary |
| 13 | + |
| 14 | +[RFC 3323][rfc] will be implemented and feature-complete, with all syntax questions resolved. The |
| 15 | +features will be prepared for stabilization. |
| 16 | + |
| 17 | +## Motivation |
| 18 | + |
| 19 | +The [RFC for restrictions][rfc] was accepted over two years ago, but the [pull request implementing |
| 20 | +it][pr] has been stalled for a long time for a variety of reasons. Implementing the feature will |
| 21 | +permit testing, feedback, and stabilization. |
| 22 | + |
| 23 | +### The status quo |
| 24 | + |
| 25 | +Sealed traits are a common pattern in Rust, but are not currently supported by the language itself. |
| 26 | +Instead, they are implemented using a combination of visibility modifiers and nested modules. Fields |
| 27 | +with restricted mutability are currently only possible with getters and setters, setting aside |
| 28 | +(ab)using `Deref` implementations. |
| 29 | + |
| 30 | +More details are available in [the RFC][rfc]. |
| 31 | + |
| 32 | +### The next 6 months |
| 33 | + |
| 34 | +The [accepted restrictions RFC][rfc] represents the end goal of this project goal. All unresolved |
| 35 | +questions should be discussed and resolved, with the two features (`impl_restrictions` and |
| 36 | +`mut_restrictions`) being ready for stabilization. Future possibilities are likely considered at a |
| 37 | +high level, but are not the focus of this project goal. |
| 38 | + |
| 39 | +## Ownership and team asks |
| 40 | + |
| 41 | +**Owner:** @jhpratt |
| 42 | + |
| 43 | +| Subgoal | Owner(s) or team(s) | Notes | |
| 44 | +| --------------------------------------- | -------------------- | ------------------------------------------ | |
| 45 | +| Discussion and moral support | ![Team][] [lang] | | |
| 46 | +| Stabilize restrictions | | | |
| 47 | +| ↳ Implementation | @jhpratt | [old PR][pr] is plausibly workable | |
| 48 | +| ↳ Code reviews | ![Team][] [compiler] | | |
| 49 | +| ↳ Design decisions | ![Team][] [lang] | for unresolved questions, including syntax | |
| 50 | +| ↳ Author stabilization report | @jhpratt | | |
| 51 | +| ↳ Stabilization decision | ![Team][] [lang] | | |
| 52 | +| Inside Rust blog post inviting feedback | ![Team][] [lang] | feedback on syntax if no team consensus | |
| 53 | + |
| 54 | +### Definitions |
| 55 | + |
| 56 | +Definitions for terms used above: |
| 57 | + |
| 58 | +- _Discussion and moral support_ is the lowest level offering, basically committing the team to nothing but good vibes and general support for this endeavor. |
| 59 | +- _Author RFC_ and _Implementation_ means actually writing the code, document, whatever. |
| 60 | +- _Design meeting_ means holding a synchronous meeting to review a proposal and provide feedback (no decision expected). |
| 61 | +- _RFC decisions_ means reviewing an RFC and deciding whether to accept. |
| 62 | +- _Org decisions_ means reaching a decision on an organizational or policy matter. |
| 63 | +- _Secondary review_ of an RFC means that the team is "tangentially" involved in the RFC and should be expected to briefly review. |
| 64 | +- _Stabilizations_ means reviewing a stabilization and report and deciding whether to stabilize. |
| 65 | +- _Standard reviews_ refers to reviews for PRs against the repository; these PRs are not expected to be unduly large or complicated. |
| 66 | +- _Prioritized nominations_ refers to prioritized lang-team response to nominated issues, with the expectation that there will be _some_ response from the next weekly triage meeting. |
| 67 | +- _Dedicated review_ means identifying an individual (or group of individuals) who will review the changes, as they're expected to require significant context. |
| 68 | +- Other kinds of decisions: |
| 69 | + - [Lang team experiments](https://lang-team.rust-lang.org/how_to/experiment.html) are used to add nightly features that do not yet have an RFC. They are limited to trusted contributors and are used to resolve design details such that an RFC can be written. |
| 70 | + - Compiler [Major Change Proposal (MCP)](https://forge.rust-lang.org/compiler/mcp.html) is used to propose a 'larger than average' change and get feedback from the compiler team. |
| 71 | + - Library [API Change Proposal (ACP)](https://std-dev-guide.rust-lang.org/development/feature-lifecycle.html) describes a change to the standard library. |
| 72 | + |
| 73 | +## Frequently asked questions |
| 74 | + |
| 75 | +### Isn't the syntax already decided? |
| 76 | + |
| 77 | +While the RFC was accepted without this being an unresolved question (aside from a simpler syntax |
| 78 | +for common cases), I believe that an attribute-based syntax such as `#[restrict(impl(crate))]` may |
| 79 | +be, but is not necessarily, favorable to the syntax in the RFC. This is because it is |
| 80 | +backwards-compatible with all existing macros and prevents nontrivial additions to the width of |
| 81 | +code. |
0 commit comments