@@ -35,7 +35,7 @@ of concept so that people can see what you are talking about.
35
35
36
36
That starts a "proposed final comment period" (pFCP), which requires
37
37
all members of the team to sign off the FCP. After they all do so,
38
- there's a week long "final comment period" where everybody can comment,
38
+ there's a 10 day long "final comment period" where everybody can comment,
39
39
and if no new concerns are raised, the PR/issue gets FCP approval.
40
40
41
41
## The logistics of writing features
@@ -119,10 +119,13 @@ a new unstable feature:
119
119
1 . Open a [ tracking issue] -
120
120
if you have an RFC, you can use the tracking issue for the RFC.
121
121
122
+ The tracking issue should be labeled with at least ` C-tracking-issue ` .
123
+ For a language feature, a label ` F-feature_name ` should be added as well.
124
+
122
125
2 . Pick a name for the feature gate (for RFCs, use the name
123
126
in the RFC).
124
127
125
- 3 . Add a feature gate declaration to ` libsyntax/feature_gate .rs `
128
+ 3 . Add a feature gate declaration to ` libsyntax/active .rs `
126
129
in the active ` declare_features ` block:
127
130
128
131
``` rust,ignore
@@ -140,8 +143,8 @@ For example:
140
143
( active, match_beginning_vert, "1.21.0", Some(44101), None),
141
144
```
142
145
143
- The current version is not actually important – the important
144
- version is when you are stabilizing a feature .
146
+ When added, the current version should be the one for the current nightly.
147
+ Once the feature is moved to ` accepted.rs ` , the version is changed to that nightly version .
145
148
146
149
4 . Prevent usage of the new feature unless the feature gate is set.
147
150
You can check it in most places in the compiler using the
@@ -153,10 +156,14 @@ version is when you are stabilizing a feature.
153
156
the pre-feature behavior or raise an error, depending on
154
157
what makes sense.
155
158
159
+ For features introducing new syntax, pre-expansion gating should be used instead.
160
+ To do so, extend the [ ` GatedSpans ` ] struct, add spans to it during parsing,
161
+ and then finally feature-gate all the spans in [ ` feature_gate::check::check_crate ` ] .
162
+
156
163
5 . Add a test to ensure the feature cannot be used without
157
164
a feature gate, by creating ` feature-gate-$feature_name.rs `
158
165
and ` feature-gate-$feature_name.stderr ` files under the
159
- ` src/test/ui/ feature-gates ` directory .
166
+ directory where the other tests for your feature reside .
160
167
161
168
6 . Add a section to the unstable book, in
162
169
` src/doc/unstable-book/src/language-features/$feature_name.md ` .
@@ -167,6 +174,8 @@ version is when you are stabilizing a feature.
167
174
8 . Get your PR reviewed and land it. You have now successfully
168
175
implemented a feature in Rust!
169
176
177
+ [ `GatedSpans` ] : https://doc.rust-lang.org/nightly/nightly-rustc/syntax/parse/struct.GatedSpans.html
178
+ [ `feature_gate::check::check_crate` ] : https://doc.rust-lang.org/nightly/nightly-rustc/syntax/feature_gate/check/fn.check_crate.html
170
179
[ value the stability of Rust ] : https://github.com/rust-lang/rfcs/blob/master/text/1122-language-semver.md
171
180
[ stability in code ] : #stability-in-code
172
181
[ here ] : https://rust-lang.github.io/rustc-guide/stabilization_guide.html
0 commit comments