Rollup merge of #102468 - RalfJung:tidy, r=jyn514
tidy: make rustc dependency error less confusing The current wording leads to very confusing messages: ``` tidy error: Dependencies for main workspace not explicitly permitted: * unicode-ident 1.0.4 (registry+https://github.com/rust-lang/crates.io-index) ``` Miri is part of that workspace, and there never was a problem adding Miri dependencies. The actual error is that due to a crate bump this now showed up as a rustc dependency, and *those* are restricted.
This commit is contained in:
commit
af33587fc5
@ -73,14 +73,11 @@
|
|||||||
/// these and all their dependencies *must not* be in the exception list.
|
/// 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 RUNTIME_CRATES: &[&str] = &["std", "core", "alloc", "test", "panic_abort", "panic_unwind"];
|
||||||
|
|
||||||
/// Crates whose dependencies must be explicitly permitted.
|
|
||||||
const RESTRICTED_DEPENDENCY_CRATES: &[&str] = &["rustc_driver", "rustc_codegen_llvm"];
|
|
||||||
|
|
||||||
/// Crates rustc is allowed to depend on. Avoid adding to the list if possible.
|
/// 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
|
/// This list is here to provide a speed-bump to adding a new dependency to
|
||||||
/// rustc. Please check with the compiler team before adding an entry.
|
/// rustc. Please check with the compiler team before adding an entry.
|
||||||
const PERMITTED_DEPENDENCIES: &[&str] = &[
|
const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
|
||||||
"addr2line",
|
"addr2line",
|
||||||
"adler",
|
"adler",
|
||||||
"ahash",
|
"ahash",
|
||||||
@ -307,7 +304,7 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
const FORBIDDEN_TO_HAVE_DUPLICATES: &[&str] = &[
|
const FORBIDDEN_TO_HAVE_DUPLICATES: &[&str] = &[
|
||||||
// These two crates take quite a long time to build, so don't allow two versions of them
|
// This crate takes quite a long time to build, so don't allow two versions of them
|
||||||
// to accidentally sneak into our dependency graph, in order to ensure we keep our CI times
|
// to accidentally sneak into our dependency graph, in order to ensure we keep our CI times
|
||||||
// under control.
|
// under control.
|
||||||
"cargo",
|
"cargo",
|
||||||
@ -324,12 +321,12 @@ pub fn check(root: &Path, cargo: &Path, bad: &mut bool) {
|
|||||||
.features(cargo_metadata::CargoOpt::AllFeatures);
|
.features(cargo_metadata::CargoOpt::AllFeatures);
|
||||||
let metadata = t!(cmd.exec());
|
let metadata = t!(cmd.exec());
|
||||||
let runtime_ids = compute_runtime_crates(&metadata);
|
let runtime_ids = compute_runtime_crates(&metadata);
|
||||||
check_exceptions(&metadata, EXCEPTIONS, runtime_ids, bad);
|
check_license_exceptions(&metadata, EXCEPTIONS, runtime_ids, bad);
|
||||||
check_dependencies(
|
check_permitted_dependencies(
|
||||||
&metadata,
|
&metadata,
|
||||||
"main workspace",
|
"rustc",
|
||||||
PERMITTED_DEPENDENCIES,
|
PERMITTED_RUSTC_DEPENDENCIES,
|
||||||
RESTRICTED_DEPENDENCY_CRATES,
|
&["rustc_driver", "rustc_codegen_llvm"],
|
||||||
bad,
|
bad,
|
||||||
);
|
);
|
||||||
check_crate_duplicate(&metadata, FORBIDDEN_TO_HAVE_DUPLICATES, bad);
|
check_crate_duplicate(&metadata, FORBIDDEN_TO_HAVE_DUPLICATES, bad);
|
||||||
@ -342,8 +339,8 @@ pub fn check(root: &Path, cargo: &Path, bad: &mut bool) {
|
|||||||
.features(cargo_metadata::CargoOpt::AllFeatures);
|
.features(cargo_metadata::CargoOpt::AllFeatures);
|
||||||
let metadata = t!(cmd.exec());
|
let metadata = t!(cmd.exec());
|
||||||
let runtime_ids = HashSet::new();
|
let runtime_ids = HashSet::new();
|
||||||
check_exceptions(&metadata, EXCEPTIONS_CRANELIFT, runtime_ids, bad);
|
check_license_exceptions(&metadata, EXCEPTIONS_CRANELIFT, runtime_ids, bad);
|
||||||
check_dependencies(
|
check_permitted_dependencies(
|
||||||
&metadata,
|
&metadata,
|
||||||
"cranelift",
|
"cranelift",
|
||||||
PERMITTED_CRANELIFT_DEPENDENCIES,
|
PERMITTED_CRANELIFT_DEPENDENCIES,
|
||||||
@ -358,13 +355,13 @@ pub fn check(root: &Path, cargo: &Path, bad: &mut bool) {
|
|||||||
.features(cargo_metadata::CargoOpt::AllFeatures);
|
.features(cargo_metadata::CargoOpt::AllFeatures);
|
||||||
let metadata = t!(cmd.exec());
|
let metadata = t!(cmd.exec());
|
||||||
let runtime_ids = HashSet::new();
|
let runtime_ids = HashSet::new();
|
||||||
check_exceptions(&metadata, EXCEPTIONS_BOOTSTRAP, runtime_ids, bad);
|
check_license_exceptions(&metadata, EXCEPTIONS_BOOTSTRAP, runtime_ids, bad);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check that all licenses are in the valid list in `LICENSES`.
|
/// Check that all licenses are in the valid list in `LICENSES`.
|
||||||
///
|
///
|
||||||
/// Packages listed in `EXCEPTIONS` are allowed for tools.
|
/// Packages listed in `exceptions` are allowed for tools.
|
||||||
fn check_exceptions(
|
fn check_license_exceptions(
|
||||||
metadata: &Metadata,
|
metadata: &Metadata,
|
||||||
exceptions: &[(&str, &str)],
|
exceptions: &[(&str, &str)],
|
||||||
runtime_ids: HashSet<&PackageId>,
|
runtime_ids: HashSet<&PackageId>,
|
||||||
@ -434,11 +431,11 @@ fn check_exceptions(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks the dependency of `RESTRICTED_DEPENDENCY_CRATES` at the given path. Changes `bad` to
|
/// Checks the dependency of `restricted_dependency_crates` at the given path. Changes `bad` to
|
||||||
/// `true` if a check failed.
|
/// `true` if a check failed.
|
||||||
///
|
///
|
||||||
/// Specifically, this checks that the dependencies are on the `PERMITTED_DEPENDENCIES`.
|
/// Specifically, this checks that the dependencies are on the `permitted_dependencies`.
|
||||||
fn check_dependencies(
|
fn check_permitted_dependencies(
|
||||||
metadata: &Metadata,
|
metadata: &Metadata,
|
||||||
descr: &str,
|
descr: &str,
|
||||||
permitted_dependencies: &[&'static str],
|
permitted_dependencies: &[&'static str],
|
||||||
|
Loading…
Reference in New Issue
Block a user