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.
This commit is contained in:
parent
478464570e
commit
8ca9c7bbe5
1 changed files with 15 additions and 7 deletions
|
|
@ -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,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue