From 09636dea74357339b4d1aab92bcc8577282553e1 Mon Sep 17 00:00:00 2001 From: Devin Jeanpierre Date: Wed, 7 Sep 2022 22:28:50 +0000 Subject: [PATCH 1/2] Add symbol-addition to the how-to for new features I don't know if I'm holding it wrong, but without these steps, I get the following error, for example: ``` error[E0425]: cannot find value `manually_drop_attr` in module `sym` [47/1826] --> compiler/rustc_feature/src/active.rs:436:14 | 436 | (active, manually_drop_attr, "1.64.0", Some(100344), None), | ^^^^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `manually_drop` | ::: /usr/local/google/home/devinj/local_programming/rust-compiler/compiler/rustc_span/src/symbol.rs:23:1 | 23 | symbols! { | -------- similarly named constant `manually_drop` defined here ``` --- src/feature-gates.md | 2 ++ src/implementing_new_features.md | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/feature-gates.md b/src/feature-gates.md index 229281f2f..dea295351 100644 --- a/src/feature-gates.md +++ b/src/feature-gates.md @@ -9,6 +9,8 @@ modifying feature gates. See ["Stability in code"] for help with adding a new feature; this section just covers how to add the feature gate *declaration*. +Add the feature name to `rustc_span/src/symbol.rs` in the `Symbols {...}` block. + Add a feature gate declaration to `rustc_feature/src/active.rs` in the active `declare_features` block: diff --git a/src/implementing_new_features.md b/src/implementing_new_features.md index ef6ae6179..36799a2d3 100644 --- a/src/implementing_new_features.md +++ b/src/implementing_new_features.md @@ -123,9 +123,9 @@ a new unstable feature: 2. Pick a name for the feature gate (for RFCs, use the name in the RFC). -3. Add a feature gate declaration to `rustc_feature/src/active.rs` - in the active `declare_features` block. See [here][add-feature-gate] for - detailed instructions. +3. Add a feature gate declaration to `rustc_feature/src/active.rs` in the active + `declare_features` block, and add the feature gate keyword to + `rustc_span/src/symbol.rs`. See [here][add-feature-gate] for detailed instructions. 4. Prevent usage of the new feature unless the feature gate is set. You can check it in most places in the compiler using the From 293d0339356706b664067caa75acaae72bb16b0a Mon Sep 17 00:00:00 2001 From: Devin Jeanpierre Date: Fri, 9 Sep 2022 10:16:12 -0700 Subject: [PATCH 2/2] src/feature-gates.md: accept review feedback Co-authored-by: Yuki Okushi --- src/feature-gates.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/feature-gates.md b/src/feature-gates.md index dea295351..9e9a83ea6 100644 --- a/src/feature-gates.md +++ b/src/feature-gates.md @@ -9,9 +9,9 @@ modifying feature gates. See ["Stability in code"] for help with adding a new feature; this section just covers how to add the feature gate *declaration*. -Add the feature name to `rustc_span/src/symbol.rs` in the `Symbols {...}` block. +First, add the feature name to `rustc_span/src/symbol.rs` in the `Symbols {...}` block. -Add a feature gate declaration to `rustc_feature/src/active.rs` in the active +Then, add a feature gate declaration to `rustc_feature/src/active.rs` in the active `declare_features` block: ```rust,ignore