Skip to content

Commit 1ddb287

Browse files
committed
Streamline find_lang_feature_issue.
It currently processes `ACTIVE_FEATURES` separately from `ACCEPTED_FEATURES`, `REMOVED_FEATURES`, and `STABLE_REMOVED_FEATURES`, for no good reason. This commit treats them uniformly.
1 parent 3c1b60c commit 1ddb287

File tree

1 file changed

+14
-15
lines changed
  • compiler/rustc_feature/src

1 file changed

+14
-15
lines changed

compiler/rustc_feature/src/lib.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ pub enum UnstableFeatures {
7979
impl UnstableFeatures {
8080
/// This takes into account `RUSTC_BOOTSTRAP`.
8181
///
82-
/// If `krate` is [`Some`], then setting `RUSTC_BOOTSTRAP=krate` will enable the nightly features.
83-
/// Otherwise, only `RUSTC_BOOTSTRAP=1` will work.
82+
/// If `krate` is [`Some`], then setting `RUSTC_BOOTSTRAP=krate` will enable the nightly
83+
/// features. Otherwise, only `RUSTC_BOOTSTRAP=1` will work.
8484
pub fn from_environment(krate: Option<&str>) -> Self {
8585
// `true` if this is a feature-staged build, i.e., on the beta or stable channel.
8686
let disable_unstable_features =
@@ -107,19 +107,18 @@ impl UnstableFeatures {
107107
}
108108

109109
fn find_lang_feature_issue(feature: Symbol) -> Option<NonZeroU32> {
110-
if let Some(info) = ACTIVE_FEATURES.iter().find(|t| t.name == feature) {
111-
info.issue
112-
} else {
113-
// search in Accepted, Removed, or Stable Removed features
114-
let found = ACCEPTED_FEATURES
115-
.iter()
116-
.chain(REMOVED_FEATURES)
117-
.chain(STABLE_REMOVED_FEATURES)
118-
.find(|t| t.name == feature);
119-
match found {
120-
Some(found) => found.issue,
121-
None => panic!("feature `{feature}` is not declared anywhere"),
122-
}
110+
// Search in all the feature lists.
111+
let found = []
112+
.iter()
113+
.chain(ACTIVE_FEATURES)
114+
.chain(ACCEPTED_FEATURES)
115+
.chain(REMOVED_FEATURES)
116+
.chain(STABLE_REMOVED_FEATURES)
117+
.find(|t| t.name == feature);
118+
119+
match found {
120+
Some(found) => found.issue,
121+
None => panic!("feature `{feature}` is not declared anywhere"),
123122
}
124123
}
125124

0 commit comments

Comments
 (0)