diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-04-30 16:10:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-30 16:10:27 +0200 |
| commit | 8a17bbfb28a976bdc6efd7a8dd0278197dec421f (patch) | |
| tree | cbdf7b465f58b1da0127ba2e350ce8cd331fa441 /src/tools | |
| parent | 17cb922b8b65876292cc90d5b307072e8cab9d61 (diff) | |
| parent | 3c00dfdf81e45efe48bf6fe7bd9a2dd7cd443776 (diff) | |
Rollup merge of #60362 - Centril:cleanup-declare-features-active, r=oli-obk
Cleanup 'active' declare_features! with uniform style + sorting. r? @oli-obk (added the FIXME you wanted) cc https://github.com/rust-lang/rust/pull/60354 cc https://github.com/rust-lang/rust/issues/60361
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/tidy/src/features.rs | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 1eab217027c..8239fd9dce0 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -173,18 +173,25 @@ pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features { let contents = t!(fs::read_to_string(base_src_path.join("libsyntax/feature_gate.rs"))); // We allow rustc-internal features to omit a tracking issue. - // These features must be marked with a `// rustc internal` in its own group. - let mut next_feature_is_rustc_internal = false; + // To make tidy accept omitting a tracking issue, group the list of features + // without one inside `// no tracking issue START` and `// no tracking issue END`. + let mut next_feature_omits_tracking_issue = false; contents.lines().zip(1..) .filter_map(|(line, line_number)| { let line = line.trim(); - if line.starts_with("// rustc internal") { - next_feature_is_rustc_internal = true; - return None; - } else if line.is_empty() { - next_feature_is_rustc_internal = false; - return None; + + // Within START and END, the tracking issue can be omitted. + match line { + "// no tracking issue START" => { + next_feature_omits_tracking_issue = true; + return None; + } + "// no tracking issue END" => { + next_feature_omits_tracking_issue = false; + return None; + } + _ => {} } let mut parts = line.split(','); @@ -198,7 +205,7 @@ pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features { let since = parts.next().unwrap().trim().trim_matches('"'); let issue_str = parts.next().unwrap().trim(); let tracking_issue = if issue_str.starts_with("None") { - if level == Status::Unstable && !next_feature_is_rustc_internal { + if level == Status::Unstable && !next_feature_omits_tracking_issue { *bad = true; tidy_error!( bad, @@ -209,7 +216,6 @@ pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features { } None } else { - next_feature_is_rustc_internal = false; let s = issue_str.split('(').nth(1).unwrap().split(')').nth(0).unwrap(); Some(s.parse().unwrap()) }; |
