Skip to content

Commit

Permalink
Rollup merge of rust-lang#84531 - Smittyvb:foo-not-feature, r=Mark-Si…
Browse files Browse the repository at this point in the history
…mulacrum

Ignore commented out lines when finding features

This fixes rust-lang#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.
  • Loading branch information
m-ou-se authored Apr 28, 2021
2 parents c7085ca + a7e23f4 commit 4b58aec
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/tools/tidy/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4b58aec

Please sign in to comment.