diff options
| author | Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> | 2023-07-03 07:18:27 +0000 |
|---|---|---|
| committer | Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> | 2023-07-03 07:18:42 +0000 |
| commit | 1e8ae5f6cbf3d835a5d7f095f09f56bb166b1a70 (patch) | |
| tree | 03445f2c0b18fa619540ac12cb05d45e4a02235f | |
| parent | d5a74249c843e06b502fb097ebea2383b9a5d9b8 (diff) | |
| download | rust-1e8ae5f6cbf3d835a5d7f095f09f56bb166b1a70.tar.gz rust-1e8ae5f6cbf3d835a5d7f095f09f56bb166b1a70.zip | |
link to PERMITTED_DEPENDENCIES in tidy error
| -rw-r--r-- | src/tools/tidy/src/deps.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index b6c57342a05..e1ee11e41c3 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -99,6 +99,8 @@ const EXCEPTIONS_BOOTSTRAP: &[(&str, &str)] = &[ /// these and all their dependencies *must not* be in the exception list. const RUNTIME_CRATES: &[&str] = &["std", "core", "alloc", "test", "panic_abort", "panic_unwind"]; +const PERMITTED_DEPS_LOCATION: &str = concat!(file!(), ":", line!()); + /// Crates rustc is allowed to depend on. Avoid adding to the list if possible. /// /// This list is here to provide a speed-bump to adding a new dependency to @@ -500,6 +502,7 @@ fn check_permitted_dependencies( restricted_dependency_crates: &[&'static str], bad: &mut bool, ) { + let mut has_permitted_dep_error = false; let mut deps = HashSet::new(); for to_check in restricted_dependency_crates { let to_check = pkg_from_name(metadata, to_check); @@ -534,6 +537,7 @@ fn check_permitted_dependencies( "could not find allowed package `{permitted}`\n\ Remove from PERMITTED_DEPENDENCIES list if it is no longer used.", ); + has_permitted_dep_error = true; } } @@ -546,9 +550,14 @@ fn check_permitted_dependencies( if dep.source.is_some() { if !permitted_dependencies.contains(dep.name.as_str()) { tidy_error!(bad, "Dependency for {descr} not explicitly permitted: {}", dep.id); + has_permitted_dep_error = true; } } } + + if has_permitted_dep_error { + eprintln!("Go to `{PERMITTED_DEPS_LOCATION}` for the list."); + } } /// Finds a package with the given name. |
