about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-10-05 16:24:31 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-10-05 18:01:11 +1100
commit95d1aa075f1bdd7acf1b0c0f0b918b3371cf987d (patch)
treed9e5590037441387d199ca97759f7bad44afbe27
parenteb209057b1c7a1e7852793e8f53eadfc9d839b2c (diff)
downloadrust-95d1aa075f1bdd7acf1b0c0f0b918b3371cf987d.tar.gz
rust-95d1aa075f1bdd7acf1b0c0f0b918b3371cf987d.zip
Record all declared features.
Currently `rust_20XX_preview` features aren't recorded as declared even
when they are explicit declared. Similarly, redundant edition-dependent
features (e.g. `test_2018_feature`) aren't recorded as declared.

This commit marks them as recorded. There is no detectable functional
change, but it makes things more consistent.
-rw-r--r--compiler/rustc_expand/src/config.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_expand/src/config.rs b/compiler/rustc_expand/src/config.rs
index ed619e02f57..40a231c4e80 100644
--- a/compiler/rustc_expand/src/config.rs
+++ b/compiler/rustc_expand/src/config.rs
@@ -124,6 +124,8 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute]) -> Features {
                         edition,
                     });
                 }
+                features.declared_lang_features.push((name, mi.span(), None));
+                features.declared_features.insert(name);
                 continue;
             }
 
@@ -137,6 +139,8 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute]) -> Features {
                     feature: name,
                     edition: features_edition,
                 });
+                features.declared_lang_features.push((name, mi.span(), None));
+                features.declared_features.insert(name);
                 continue;
             }