@@ -19,32 +19,52 @@ mod proc_macro_deps;
1919#[ rustfmt:: skip]  
2020const  LICENSES :  & [ & str ]  = & [ 
2121    // tidy-alphabetical-start 
22-     "(MIT OR Apache-2.0) AND Unicode-3.0" ,                  // unicode_ident (1.0.14) 
23-     "(MIT OR Apache-2.0) AND Unicode-DFS-2016" ,             // unicode_ident (1.0.12) 
2422    "0BSD OR MIT OR Apache-2.0" ,                            // adler2 license 
25-     "0BSD" , 
2623    "Apache-2.0 / MIT" , 
2724    "Apache-2.0 OR ISC OR MIT" , 
2825    "Apache-2.0 OR MIT" , 
2926    "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT" ,  // wasi license 
30-     "Apache-2.0" , 
3127    "Apache-2.0/MIT" , 
3228    "BSD-2-Clause OR Apache-2.0 OR MIT" ,                    // zerocopy 
29+     "BSD-2-Clause OR MIT OR Apache-2.0" , 
30+     "BSD-3-Clause/MIT" , 
31+     "CC0-1.0 OR MIT-0 OR Apache-2.0" , 
3332    "ISC" , 
3433    "MIT / Apache-2.0" , 
3534    "MIT AND (MIT OR Apache-2.0)" , 
3635    "MIT AND Apache-2.0 WITH LLVM-exception AND (MIT OR Apache-2.0)" ,  // compiler-builtins 
37-     "MIT OR Apache-2.0 OR LGPL-2.1-or-later" ,               // r-efi, r-efi-alloc 
36+     "MIT OR Apache-2.0 OR BSD-1-Clause" , 
37+     "MIT OR Apache-2.0 OR LGPL-2.1-or-later" ,               // r-efi, r-efi-alloc; LGPL is not acceptable, but we use it under MIT OR Apache-2.0 
3838    "MIT OR Apache-2.0 OR Zlib" ,                            // tinyvec_macros 
3939    "MIT OR Apache-2.0" , 
4040    "MIT OR Zlib OR Apache-2.0" ,                            // miniz_oxide 
4141    "MIT" , 
4242    "MIT/Apache-2.0" , 
43-     "Unicode-3.0" ,                                          // icu4x 
44-     "Unicode-DFS-2016" ,                                     // tinystr 
4543    "Unlicense OR MIT" , 
4644    "Unlicense/MIT" , 
45+     // tidy-alphabetical-end 
46+ ] ; 
47+ 
48+ /// These are licenses that are allowed for rustc, tools, etc. But not for the runtime! 
49+ #[ rustfmt:: skip]  
50+ const  LICENSES_TOOLS :  & [ & str ]  = & [ 
51+     // tidy-alphabetical-start 
52+     "(Apache-2.0 OR MIT) AND BSD-3-Clause" , 
53+     "(MIT OR Apache-2.0) AND Unicode-3.0" ,                  // unicode_ident (1.0.14) 
54+     "(MIT OR Apache-2.0) AND Unicode-DFS-2016" ,             // unicode_ident (1.0.12) 
55+     "0BSD" , 
56+     "Apache-2.0 AND ISC" , 
57+     "Apache-2.0 OR BSL-1.0" ,   // BSL is not acceptable, but we use it under Apache-2.0 
58+     "Apache-2.0 WITH LLVM-exception" , 
59+     "Apache-2.0" , 
60+     "BSD-2-Clause" , 
61+     "BSD-3-Clause" , 
62+     "CC0-1.0 OR Apache-2.0 OR Apache-2.0 WITH LLVM-exception" , 
63+     "CC0-1.0" , 
64+     "Unicode-3.0" ,                                          // icu4x 
65+     "Unicode-DFS-2016" ,                                     // tinystr 
4766    "Zlib OR Apache-2.0 OR MIT" ,                            // tinyvec 
67+     "Zlib" , 
4868    // tidy-alphabetical-end 
4969] ; 
5070
@@ -89,17 +109,15 @@ pub(crate) const WORKSPACES: &[WorkspaceInfo<'static>] = &[
89109        ) ) , 
90110        submodules :  & [ ] , 
91111    } , 
92-     { 
93-         WorkspaceInfo  { 
94-             path :  "compiler/rustc_codegen_cranelift" , 
95-             exceptions :  EXCEPTIONS_CRANELIFT , 
96-             crates_and_deps :  Some ( ( 
97-                 & [ "rustc_codegen_cranelift" ] , 
98-                 PERMITTED_CRANELIFT_DEPENDENCIES , 
99-                 PERMITTED_CRANELIFT_DEPS_LOCATION , 
100-             ) ) , 
101-             submodules :  & [ ] , 
102-         } 
112+     WorkspaceInfo  { 
113+         path :  "compiler/rustc_codegen_cranelift" , 
114+         exceptions :  EXCEPTIONS_CRANELIFT , 
115+         crates_and_deps :  Some ( ( 
116+             & [ "rustc_codegen_cranelift" ] , 
117+             PERMITTED_CRANELIFT_DEPENDENCIES , 
118+             PERMITTED_CRANELIFT_DEPS_LOCATION , 
119+         ) ) , 
120+         submodules :  & [ ] , 
103121    } , 
104122    WorkspaceInfo  { 
105123        path :  "compiler/rustc_codegen_gcc" , 
@@ -169,19 +187,8 @@ pub(crate) const WORKSPACES: &[WorkspaceInfo<'static>] = &[
169187#[ rustfmt:: skip]  
170188const  EXCEPTIONS :  ExceptionList  = & [ 
171189    // tidy-alphabetical-start 
172-     ( "ar_archive_writer" ,  "Apache-2.0 WITH LLVM-exception" ) ,  // rustc 
173-     ( "arrayref" ,  "BSD-2-Clause" ) ,                             // rustc 
174-     ( "blake3" ,  "CC0-1.0 OR Apache-2.0 OR Apache-2.0 WITH LLVM-exception" ) ,   // rustc 
175190    ( "colored" ,  "MPL-2.0" ) ,                                   // rustfmt 
176-     ( "constant_time_eq" ,  "CC0-1.0 OR MIT-0 OR Apache-2.0" ) ,   // rustc 
177-     ( "dissimilar" ,  "Apache-2.0" ) ,                             // rustdoc, rustc_lexer (few tests) via expect-test, (dev deps) 
178-     ( "fluent-langneg" ,  "Apache-2.0" ) ,                         // rustc (fluent translations) 
179-     ( "foldhash" ,  "Zlib" ) ,                                     // rustc 
180191    ( "option-ext" ,  "MPL-2.0" ) ,                                // cargo-miri (via `directories`) 
181-     ( "rustc_apfloat" ,  "Apache-2.0 WITH LLVM-exception" ) ,      // rustc (license is the same as LLVM uses) 
182-     ( "ryu" ,  "Apache-2.0 OR BSL-1.0" ) ,  // BSL is not acceptble, but we use it under Apache-2.0                       // cargo/... (because of serde) 
183-     ( "self_cell" ,  "Apache-2.0" ) ,                              // rustc (fluent translations) 
184-     ( "wasi-preview1-component-adapter-provider" ,  "Apache-2.0 WITH LLVM-exception" ) ,  // rustc 
185192    // tidy-alphabetical-end 
186193] ; 
187194
@@ -198,57 +205,22 @@ const EXCEPTIONS_STDLIB: ExceptionList = &[
198205
199206const  EXCEPTIONS_CARGO :  ExceptionList  = & [ 
200207    // tidy-alphabetical-start 
201-     ( "arrayref" ,  "BSD-2-Clause" ) , 
202208    ( "bitmaps" ,  "MPL-2.0+" ) , 
203-     ( "blake3" ,  "CC0-1.0 OR Apache-2.0 OR Apache-2.0 WITH LLVM-exception" ) , 
204-     ( "ciborium" ,  "Apache-2.0" ) , 
205-     ( "ciborium-io" ,  "Apache-2.0" ) , 
206-     ( "ciborium-ll" ,  "Apache-2.0" ) , 
207-     ( "constant_time_eq" ,  "CC0-1.0 OR MIT-0 OR Apache-2.0" ) , 
208-     ( "dunce" ,  "CC0-1.0 OR MIT-0 OR Apache-2.0" ) , 
209-     ( "encoding_rs" ,  "(Apache-2.0 OR MIT) AND BSD-3-Clause" ) , 
210-     ( "fiat-crypto" ,  "MIT OR Apache-2.0 OR BSD-1-Clause" ) , 
211-     ( "foldhash" ,  "Zlib" ) , 
212209    ( "im-rc" ,  "MPL-2.0+" ) , 
213-     ( "libz-rs-sys" ,  "Zlib" ) , 
214-     ( "normalize-line-endings" ,  "Apache-2.0" ) , 
215-     ( "openssl" ,  "Apache-2.0" ) , 
216-     ( "ring" ,  "Apache-2.0 AND ISC" ) , 
217-     ( "ryu" ,  "Apache-2.0 OR BSL-1.0" ) ,  // BSL is not acceptble, but we use it under Apache-2.0 
218-     ( "similar" ,  "Apache-2.0" ) , 
219210    ( "sized-chunks" ,  "MPL-2.0+" ) , 
220-     ( "subtle" ,  "BSD-3-Clause" ) , 
221-     ( "supports-hyperlinks" ,  "Apache-2.0" ) , 
222-     ( "unicode-bom" ,  "Apache-2.0" ) , 
223-     ( "zlib-rs" ,  "Zlib" ) , 
224211    // tidy-alphabetical-end 
225212] ; 
226213
227214const  EXCEPTIONS_RUST_ANALYZER :  ExceptionList  = & [ 
228215    // tidy-alphabetical-start 
229-     ( "dissimilar" ,  "Apache-2.0" ) , 
230-     ( "foldhash" ,  "Zlib" ) , 
231-     ( "notify" ,  "CC0-1.0" ) , 
232216    ( "option-ext" ,  "MPL-2.0" ) , 
233-     ( "pulldown-cmark-to-cmark" ,  "Apache-2.0" ) , 
234-     ( "rustc_apfloat" ,  "Apache-2.0 WITH LLVM-exception" ) , 
235-     ( "ryu" ,  "Apache-2.0 OR BSL-1.0" ) ,  // BSL is not acceptble, but we use it under Apache-2.0 
236-     ( "scip" ,  "Apache-2.0" ) , 
237217    // tidy-alphabetical-end 
238218] ; 
239219
240220const  EXCEPTIONS_RUSTC_PERF :  ExceptionList  = & [ 
241221    // tidy-alphabetical-start 
242-     ( "alloc-no-stdlib" ,  "BSD-3-Clause" ) , 
243-     ( "alloc-stdlib" ,  "BSD-3-Clause" ) , 
244-     ( "brotli" ,  "BSD-3-Clause/MIT" ) , 
245-     ( "brotli-decompressor" ,  "BSD-3-Clause/MIT" ) , 
246-     ( "encoding_rs" ,  "(Apache-2.0 OR MIT) AND BSD-3-Clause" ) , 
247222    ( "inferno" ,  "CDDL-1.0" ) , 
248223    ( "option-ext" ,  "MPL-2.0" ) , 
249-     ( "ryu" ,  "Apache-2.0 OR BSL-1.0" ) , 
250-     ( "snap" ,  "BSD-3-Clause" ) , 
251-     ( "subtle" ,  "BSD-3-Clause" ) , 
252224    // tidy-alphabetical-end 
253225] ; 
254226
@@ -258,36 +230,10 @@ const EXCEPTIONS_RUSTBOOK: ExceptionList = &[
258230    ( "cssparser-macros" ,  "MPL-2.0" ) , 
259231    ( "dtoa-short" ,  "MPL-2.0" ) , 
260232    ( "mdbook" ,  "MPL-2.0" ) , 
261-     ( "ryu" ,  "Apache-2.0 OR BSL-1.0" ) , 
262233    // tidy-alphabetical-end 
263234] ; 
264235
265- const  EXCEPTIONS_CRANELIFT :  ExceptionList  = & [ 
266-     // tidy-alphabetical-start 
267-     ( "cranelift-assembler-x64" ,  "Apache-2.0 WITH LLVM-exception" ) , 
268-     ( "cranelift-assembler-x64-meta" ,  "Apache-2.0 WITH LLVM-exception" ) , 
269-     ( "cranelift-bforest" ,  "Apache-2.0 WITH LLVM-exception" ) , 
270-     ( "cranelift-bitset" ,  "Apache-2.0 WITH LLVM-exception" ) , 
271-     ( "cranelift-codegen" ,  "Apache-2.0 WITH LLVM-exception" ) , 
272-     ( "cranelift-codegen-meta" ,  "Apache-2.0 WITH LLVM-exception" ) , 
273-     ( "cranelift-codegen-shared" ,  "Apache-2.0 WITH LLVM-exception" ) , 
274-     ( "cranelift-control" ,  "Apache-2.0 WITH LLVM-exception" ) , 
275-     ( "cranelift-entity" ,  "Apache-2.0 WITH LLVM-exception" ) , 
276-     ( "cranelift-frontend" ,  "Apache-2.0 WITH LLVM-exception" ) , 
277-     ( "cranelift-isle" ,  "Apache-2.0 WITH LLVM-exception" ) , 
278-     ( "cranelift-jit" ,  "Apache-2.0 WITH LLVM-exception" ) , 
279-     ( "cranelift-module" ,  "Apache-2.0 WITH LLVM-exception" ) , 
280-     ( "cranelift-native" ,  "Apache-2.0 WITH LLVM-exception" ) , 
281-     ( "cranelift-object" ,  "Apache-2.0 WITH LLVM-exception" ) , 
282-     ( "cranelift-srcgen" ,  "Apache-2.0 WITH LLVM-exception" ) , 
283-     ( "foldhash" ,  "Zlib" ) , 
284-     ( "mach2" ,  "BSD-2-Clause OR MIT OR Apache-2.0" ) , 
285-     ( "regalloc2" ,  "Apache-2.0 WITH LLVM-exception" ) , 
286-     ( "target-lexicon" ,  "Apache-2.0 WITH LLVM-exception" ) , 
287-     ( "wasmtime-jit-icache-coherence" ,  "Apache-2.0 WITH LLVM-exception" ) , 
288-     ( "wasmtime-math" ,  "Apache-2.0 WITH LLVM-exception" ) , 
289-     // tidy-alphabetical-end 
290- ] ; 
236+ const  EXCEPTIONS_CRANELIFT :  ExceptionList  = & [ ] ; 
291237
292238const  EXCEPTIONS_GCC :  ExceptionList  = & [ 
293239    // tidy-alphabetical-start 
@@ -296,13 +242,9 @@ const EXCEPTIONS_GCC: ExceptionList = &[
296242    // tidy-alphabetical-end 
297243] ; 
298244
299- const  EXCEPTIONS_BOOTSTRAP :  ExceptionList  = & [ 
300-     ( "ryu" ,  "Apache-2.0 OR BSL-1.0" ) ,  // through serde. BSL is not acceptble, but we use it under Apache-2.0 
301- ] ; 
245+ const  EXCEPTIONS_BOOTSTRAP :  ExceptionList  = & [ ] ; 
302246
303- const  EXCEPTIONS_UEFI_QEMU_TEST :  ExceptionList  = & [ 
304-     ( "r-efi" ,  "MIT OR Apache-2.0 OR LGPL-2.1-or-later" ) ,  // LGPL is not acceptable, but we use it under MIT OR Apache-2.0 
305- ] ; 
247+ const  EXCEPTIONS_UEFI_QEMU_TEST :  ExceptionList  = & [ ] ; 
306248
307249#[ derive( Clone ,  Copy ) ]  
308250struct  ListLocation  { 
@@ -867,6 +809,11 @@ fn check_license_exceptions(
867809                } 
868810            } 
869811        } 
812+         if  LICENSES . contains ( license)  || LICENSES_TOOLS . contains ( license)  { 
813+             check. error ( format ! ( 
814+                 "dependency exception `{name}` is not necessary. `{license}` is an allowed license" 
815+             ) ) ; 
816+         } 
870817    } 
871818
872819    let  exception_names:  Vec < _ >  = exceptions. iter ( ) . map ( |( name,  _license) | * name) . collect ( ) ; 
@@ -890,7 +837,7 @@ fn check_license_exceptions(
890837                continue ; 
891838            } 
892839        } ; 
893-         if  !LICENSES . contains ( & license. as_str ( ) )  { 
840+         if  !LICENSES . contains ( & license. as_str ( ) )  && ! LICENSES_TOOLS . contains ( & license . as_str ( ) )   { 
894841            check. error ( format ! ( 
895842                "invalid license `{}` for package `{}` in workspace `{workspace}`" , 
896843                license,  pkg. id
0 commit comments