Skip to content

Commit 0be3dca

Browse files
EliahKaganclaude
andcommitted
Ship the Rust standard library's COPYRIGHT file in release archives
The Rust standard library (std, core, alloc, compiler_builtins, hashbrown, libc, etc.) is statically linked into every compiled Rust binary. It is dual-licensed under Apache-2.0 OR MIT, and — unlike GCC's runtime library — has no linking exception that would exempt binary distributions from attribution requirements. This is a known gap in the Rust ecosystem: * "Does the standard library have linking exceptions to their licensing?" — the answer is no. https://internals.rust-lang.org/t/does-the-standard-library-have-linking-exceptions-to-their-licensing/11377 * "It's unclear exactly what license text must be included in a Rust binary" — open since 2019, still unresolved. rust-lang/rust#67014 The Rust toolchain ships a COPYRIGHT-library.html file at $(rustc --print sysroot)/share/doc/rust/COPYRIGHT-library.html that lists every component of the standard library, its license, its copyright holders, and (for out-of-tree deps) the full license text. Copy this file into each release archive as RUST-STDLIB-COPYRIGHT.html so that anyone distributing gix/ein binaries has the attribution material the license requires. If a future toolchain version moves or removes the file, the step warns but does not fail the build — the file is authoritative when present but we should not break releases over a toolchain layout change. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6938ff4 commit 0be3dca

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,20 @@ jobs:
303303
cp -- "${out_dirs[0]}/third_party_licenses.txt" "$ARCHIVE/THIRD-PARTY-LICENSES.txt"
304304
cp -- "${out_dirs[0]}/third_party_licenses.json" "$ARCHIVE/THIRD-PARTY-LICENSES.json"
305305
306+
# The Rust standard library is statically linked into every
307+
# Rust binary and is dual-licensed under Apache-2.0 OR MIT
308+
# with NO linking exception (unlike GCC's runtime). Ship its
309+
# own COPYRIGHT file so users have the attribution material
310+
# the license requires. The file lives in the sysroot of
311+
# whatever toolchain built this binary.
312+
stdlib_copyright="$(rustc --print sysroot)/share/doc/rust/COPYRIGHT-library.html"
313+
if [ -f "$stdlib_copyright" ]; then
314+
cp -- "$stdlib_copyright" "$ARCHIVE/RUST-STDLIB-COPYRIGHT.html"
315+
else
316+
printf 'warning: %s not found — stdlib attribution will be missing from the archive\n' \
317+
"$stdlib_copyright" >&2
318+
fi
319+
306320
# Validate the manifest: reject stubs, verify the JSON is
307321
# parseable and has the expected feature profile and a plausible
308322
# crate count, and confirm no crate is missing license text.

0 commit comments

Comments
 (0)