Skip to content

Commit 72817ed

Browse files
committed
feature-guide: update instructions on how to check if a feature is enabled
1 parent dd8a20e commit 72817ed

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

feature-guide.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,7 @@ In order to implement a new unstable feature, you need to do the following steps
114114
115115
The current version is not actually important – the important version is when you are *stabilizing* a feature.
116116
4. Prevent usage of the new feature unless the feature gate is set.
117-
You can check it in most places in the compiler using the expression
118-
```
119-
tcx.sess.features().borrow().$feature_name
120-
```
117+
You can check it in most places in the compiler using the expression `tcx.features().$feature_name` (or `sess.features_untracked().borrow().$feature_name` if the tcx is unavailable)
121118
122119
If the feature gate is not set, you should either maintain the pre-feature behavior or raise an error, depending on what makes sense.
123120
5. Add a test to ensure the feature cannot be used without a feature gate, by creating `feature-gate-$feature_name.rs` and `feature-gate-$feature_name.stderr` fiels under the `src/test/ui/feature-gates` directory.

0 commit comments

Comments
 (0)