Skip to content

Commit f798ada

Browse files
committed
Auto merge of #113275 - Nilstrieb:perm, r=fee1-dead
link to PERMITTED_DEPENDENCIES in tidy error
2 parents 737b461 + 1e8ae5f commit f798ada

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/tools/tidy/src/deps.rs

+9
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ const EXCEPTIONS_BOOTSTRAP: &[(&str, &str)] = &[
9999
/// these and all their dependencies *must not* be in the exception list.
100100
const RUNTIME_CRATES: &[&str] = &["std", "core", "alloc", "test", "panic_abort", "panic_unwind"];
101101

102+
const PERMITTED_DEPS_LOCATION: &str = concat!(file!(), ":", line!());
103+
102104
/// Crates rustc is allowed to depend on. Avoid adding to the list if possible.
103105
///
104106
/// This list is here to provide a speed-bump to adding a new dependency to
@@ -500,6 +502,7 @@ fn check_permitted_dependencies(
500502
restricted_dependency_crates: &[&'static str],
501503
bad: &mut bool,
502504
) {
505+
let mut has_permitted_dep_error = false;
503506
let mut deps = HashSet::new();
504507
for to_check in restricted_dependency_crates {
505508
let to_check = pkg_from_name(metadata, to_check);
@@ -534,6 +537,7 @@ fn check_permitted_dependencies(
534537
"could not find allowed package `{permitted}`\n\
535538
Remove from PERMITTED_DEPENDENCIES list if it is no longer used.",
536539
);
540+
has_permitted_dep_error = true;
537541
}
538542
}
539543

@@ -546,9 +550,14 @@ fn check_permitted_dependencies(
546550
if dep.source.is_some() {
547551
if !permitted_dependencies.contains(dep.name.as_str()) {
548552
tidy_error!(bad, "Dependency for {descr} not explicitly permitted: {}", dep.id);
553+
has_permitted_dep_error = true;
549554
}
550555
}
551556
}
557+
558+
if has_permitted_dep_error {
559+
eprintln!("Go to `{PERMITTED_DEPS_LOCATION}` for the list.");
560+
}
552561
}
553562

554563
/// Finds a package with the given name.

0 commit comments

Comments
 (0)