1
Fork 0

Rename Features::active_features.

The word "active" is currently used in two different and confusing ways:
- `ACTIVE_FEATURES` actually means "available unstable features"
- `Features::active_features` actually means "features declared in the
  crate's code", which can include feature within `ACTIVE_FEATURES` but
  also others.

(This is also distinct from "enabled" features which includes declared
features but also some edition-specific features automatically enabled
depending on the edition in use.)

This commit changes the `Features::active_features` to
`Features::declared_features` which actually matches its meaning.
Likewise, `Features::active` becomes `Features::declared`.
This commit is contained in:
Nicholas Nethercote 2023-10-05 16:08:07 +11:00
parent b229be0127
commit 4602d9257d
4 changed files with 16 additions and 13 deletions

View file

@ -155,7 +155,7 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute]) -> Features {
if let Some(Feature { since, .. }) = ACCEPTED_FEATURES.iter().find(|f| name == f.name) {
let since = Some(Symbol::intern(since));
features.declared_lang_features.push((name, mi.span(), since));
features.active_features.insert(name);
features.declared_features.insert(name);
continue;
}
@ -173,14 +173,14 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute]) -> Features {
if let Some(f) = ACTIVE_FEATURES.iter().find(|f| name == f.name) {
f.set(&mut features);
features.declared_lang_features.push((name, mi.span(), None));
features.active_features.insert(name);
features.declared_features.insert(name);
continue;
}
// Otherwise, the feature is unknown. Record it at a lib feature.
// It will be checked later.
features.declared_lib_features.push((name, mi.span()));
features.active_features.insert(name);
features.declared_features.insert(name);
}
}