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.
This commit is contained in:
Jack Huey 2021-04-28 22:59:24 -04:00 committed by GitHub
commit 4da8c22e9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -423,6 +423,15 @@ fn map_lib_features(
continue;
}};
}
lazy_static::lazy_static! {
static ref COMMENT_LINE: Regex = Regex::new(r"^\s*//").unwrap();
}
// exclude commented out lines
if COMMENT_LINE.is_match(line) {
continue;
}
if let Some((ref name, ref mut f)) = becoming_feature {
if f.tracking_issue.is_none() {
f.tracking_issue = find_attr_val(line, "issue").and_then(handle_issue_none);