Skip to content

Commit 4da8c22

Browse files
authored
Rollup merge of #84531 - Smittyvb:foo-not-feature, r=Mark-Simulacrum
Ignore commented out lines when finding features This fixes #76246, where commented out lines were being detected as features by `tidy`, by ignoring those lines when looking for features. It's still not perfect, since it can be fooled by things like: ```rust /* #[unstable(feature = "foo", issue = "1234")] */ ``` But luckily that never happens in `rustc`, so `foo` now ceases to appear in the unstable book.
2 parents dbfe0e9 + a7e23f4 commit 4da8c22

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/tools/tidy/src/features.rs

+9
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,15 @@ fn map_lib_features(
423423
continue;
424424
}};
425425
}
426+
427+
lazy_static::lazy_static! {
428+
static ref COMMENT_LINE: Regex = Regex::new(r"^\s*//").unwrap();
429+
}
430+
// exclude commented out lines
431+
if COMMENT_LINE.is_match(line) {
432+
continue;
433+
}
434+
426435
if let Some((ref name, ref mut f)) = becoming_feature {
427436
if f.tracking_issue.is_none() {
428437
f.tracking_issue = find_attr_val(line, "issue").and_then(handle_issue_none);

0 commit comments

Comments
 (0)