diff options
| author | Pascal Hertleif <pascal@technocreatives.com> | 2019-08-24 17:45:03 +0200 |
|---|---|---|
| committer | Pascal Hertleif <pascal@technocreatives.com> | 2019-08-24 17:45:03 +0200 |
| commit | 8ca9c7bbe5f2be252881e1edbd2a2ce97e75244f (patch) | |
| tree | f5b36f5d05c3f1a1761f08c9ec10fed4e26912be /src | |
| parent | 478464570e60523adc6d303577d1782229ca1f93 (diff) | |
| download | rust-8ca9c7bbe5f2be252881e1edbd2a2ce97e75244f.tar.gz rust-8ca9c7bbe5f2be252881e1edbd2a2ce97e75244f.zip | |
Fix tidy feature gate error reporting
Feature gate definitions were split into multiple files in #63824 but tidy kept reporting the hard-coded path. Now, it shows the full path to the correct file.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/tidy/src/features.rs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 468e5600101..50e9116c778 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -176,7 +176,10 @@ pub fn check(path: &Path, bad: &mut bool, verbose: bool) -> CollectedFeatures { CollectedFeatures { lib: lib_features, lang: features } } -fn format_features<'a>(features: &'a Features, family: &'a str) -> impl Iterator<Item = String> + 'a { +fn format_features<'a>( + features: &'a Features, + family: &'a str, +) -> impl Iterator<Item = String> + 'a { features.iter().map(move |(name, feature)| { format!("{:<32} {:<8} {:<12} {:<8}", name, @@ -228,7 +231,8 @@ pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features { } fn collect_lang_features_in(base: &Path, file: &str, bad: &mut bool) -> Features { - let contents = t!(fs::read_to_string(base.join("libsyntax/feature_gate").join(file))); + let path = base.join("libsyntax/feature_gate").join(file); + let contents = t!(fs::read_to_string(&path)); // We allow rustc-internal features to omit a tracking issue. // To make tidy accept omitting a tracking issue, group the list of features @@ -259,8 +263,9 @@ fn collect_lang_features_in(base: &Path, file: &str, bad: &mut bool) -> Features if in_feature_group { tidy_error!( bad, - // ignore-tidy-linelength - "libsyntax/feature_gate.rs:{}: new feature group is started without ending the previous one", + "{}:{}: \ + new feature group is started without ending the previous one", + path.display(), line_number, ); } @@ -289,7 +294,8 @@ fn collect_lang_features_in(base: &Path, file: &str, bad: &mut bool) -> Features Err(err) => { tidy_error!( bad, - "libsyntax/feature_gate.rs:{}: failed to parse since: {} ({:?})", + "{}:{}: failed to parse since: {} ({:?})", + path.display(), line_number, since_str, err, @@ -301,7 +307,8 @@ fn collect_lang_features_in(base: &Path, file: &str, bad: &mut bool) -> Features if prev_since > since { tidy_error!( bad, - "libsyntax/feature_gate.rs:{}: feature {} is not sorted by since", + "{}:{}: feature {} is not sorted by since", + path.display(), line_number, name, ); @@ -315,7 +322,8 @@ fn collect_lang_features_in(base: &Path, file: &str, bad: &mut bool) -> Features *bad = true; tidy_error!( bad, - "libsyntax/feature_gate.rs:{}: no tracking issue for feature {}", + "{}:{}: no tracking issue for feature {}", + path.display(), line_number, name, ); |
