@@ -73,14 +73,11 @@ const EXCEPTIONS_BOOTSTRAP: &[(&str, &str)] = &[
73
73
/// these and all their dependencies *must not* be in the exception list.
74
74
const RUNTIME_CRATES : & [ & str ] = & [ "std" , "core" , "alloc" , "test" , "panic_abort" , "panic_unwind" ] ;
75
75
76
- /// Crates whose dependencies must be explicitly permitted.
77
- const RESTRICTED_DEPENDENCY_CRATES : & [ & str ] = & [ "rustc_driver" , "rustc_codegen_llvm" ] ;
78
-
79
76
/// Crates rustc is allowed to depend on. Avoid adding to the list if possible.
80
77
///
81
78
/// This list is here to provide a speed-bump to adding a new dependency to
82
79
/// rustc. Please check with the compiler team before adding an entry.
83
- const PERMITTED_DEPENDENCIES : & [ & str ] = & [
80
+ const PERMITTED_RUSTC_DEPENDENCIES : & [ & str ] = & [
84
81
"addr2line" ,
85
82
"adler" ,
86
83
"ahash" ,
@@ -307,7 +304,7 @@ const PERMITTED_CRANELIFT_DEPENDENCIES: &[&str] = &[
307
304
] ;
308
305
309
306
const FORBIDDEN_TO_HAVE_DUPLICATES : & [ & str ] = & [
310
- // These two crates take quite a long time to build, so don't allow two versions of them
307
+ // This crate takes quite a long time to build, so don't allow two versions of them
311
308
// to accidentally sneak into our dependency graph, in order to ensure we keep our CI times
312
309
// under control.
313
310
"cargo" ,
@@ -324,12 +321,12 @@ pub fn check(root: &Path, cargo: &Path, bad: &mut bool) {
324
321
. features ( cargo_metadata:: CargoOpt :: AllFeatures ) ;
325
322
let metadata = t ! ( cmd. exec( ) ) ;
326
323
let runtime_ids = compute_runtime_crates ( & metadata) ;
327
- check_exceptions ( & metadata, EXCEPTIONS , runtime_ids, bad) ;
328
- check_dependencies (
324
+ check_license_exceptions ( & metadata, EXCEPTIONS , runtime_ids, bad) ;
325
+ check_permitted_dependencies (
329
326
& metadata,
330
- "main workspace " ,
331
- PERMITTED_DEPENDENCIES ,
332
- RESTRICTED_DEPENDENCY_CRATES ,
327
+ "rustc " ,
328
+ PERMITTED_RUSTC_DEPENDENCIES ,
329
+ & [ "rustc_driver" , "rustc_codegen_llvm" ] ,
333
330
bad,
334
331
) ;
335
332
check_crate_duplicate ( & metadata, FORBIDDEN_TO_HAVE_DUPLICATES , bad) ;
@@ -342,8 +339,8 @@ pub fn check(root: &Path, cargo: &Path, bad: &mut bool) {
342
339
. features ( cargo_metadata:: CargoOpt :: AllFeatures ) ;
343
340
let metadata = t ! ( cmd. exec( ) ) ;
344
341
let runtime_ids = HashSet :: new ( ) ;
345
- check_exceptions ( & metadata, EXCEPTIONS_CRANELIFT , runtime_ids, bad) ;
346
- check_dependencies (
342
+ check_license_exceptions ( & metadata, EXCEPTIONS_CRANELIFT , runtime_ids, bad) ;
343
+ check_permitted_dependencies (
347
344
& metadata,
348
345
"cranelift" ,
349
346
PERMITTED_CRANELIFT_DEPENDENCIES ,
@@ -358,13 +355,13 @@ pub fn check(root: &Path, cargo: &Path, bad: &mut bool) {
358
355
. features ( cargo_metadata:: CargoOpt :: AllFeatures ) ;
359
356
let metadata = t ! ( cmd. exec( ) ) ;
360
357
let runtime_ids = HashSet :: new ( ) ;
361
- check_exceptions ( & metadata, EXCEPTIONS_BOOTSTRAP , runtime_ids, bad) ;
358
+ check_license_exceptions ( & metadata, EXCEPTIONS_BOOTSTRAP , runtime_ids, bad) ;
362
359
}
363
360
364
361
/// Check that all licenses are in the valid list in `LICENSES`.
365
362
///
366
- /// Packages listed in `EXCEPTIONS ` are allowed for tools.
367
- fn check_exceptions (
363
+ /// Packages listed in `exceptions ` are allowed for tools.
364
+ fn check_license_exceptions (
368
365
metadata : & Metadata ,
369
366
exceptions : & [ ( & str , & str ) ] ,
370
367
runtime_ids : HashSet < & PackageId > ,
@@ -434,11 +431,11 @@ fn check_exceptions(
434
431
}
435
432
}
436
433
437
- /// Checks the dependency of `RESTRICTED_DEPENDENCY_CRATES ` at the given path. Changes `bad` to
434
+ /// Checks the dependency of `restricted_dependency_crates ` at the given path. Changes `bad` to
438
435
/// `true` if a check failed.
439
436
///
440
- /// Specifically, this checks that the dependencies are on the `PERMITTED_DEPENDENCIES `.
441
- fn check_dependencies (
437
+ /// Specifically, this checks that the dependencies are on the `permitted_dependencies `.
438
+ fn check_permitted_dependencies (
442
439
metadata : & Metadata ,
443
440
descr : & str ,
444
441
permitted_dependencies : & [ & ' static str ] ,
0 commit comments