]> git.proxmox.com Git - rustc.git/blame - src/doc/rustc-dev-guide/src/licenses.md
New upstream version 1.74.1+dfsg1
[rustc.git] / src / doc / rustc-dev-guide / src / licenses.md
CommitLineData
ba9703b0
XL
1# `rust-lang/rust` Licenses
2
3The `rustc` compiler source and standard library are dual licensed under the [Apache License v2.0](https://github.com/rust-lang/rust/blob/master/LICENSE-APACHE) and the [MIT License](https://github.com/rust-lang/rust/blob/master/LICENSE-MIT) unless otherwise specified.
4
5Detailed licensing information is available in the [COPYRIGHT document](https://github.com/rust-lang/rust/blob/master/COPYRIGHT) of the `rust-lang/rust` repository.
781aab86
FG
6
7## Guidelines for reviewers
8
9In general, reviewers need to be looking not only for the code quality of contributions but also
10that they are properly licensed.
11We have some tips below for things to look out for when reviewing, but if you ever feel uncertain
12as to whether some code might be properly licensed, err on the safe side — reach out to the Council
13or Compiler Team Leads for feedback!
14
15Things to watch out for:
16
17- The PR author states that they copied, ported, or adapted the code from some other source.
18- There is a comment in the code pointing to a webpage or describing where the algorithm was taken
19from.
20- The algorithm or code pattern seems like it was likely copied from somewhere else.
21- When adding new dependencies, double check the dependency's license.
22
23In all of these cases, we will want to check that source to make sure it it is licensed in a way
24that is compatible with Rust’s license.
25
26Examples
27
28- Porting C code from a GPL project, like GNU binutils, is not allowed. That would require Rust
29itself to be licensed under the GPL.
30- Copying code from an algorithms text book may be allowed, but some algorithms are patented.
31
32## Porting
33
34Contributions to rustc, especially around platform and compiler intrinsics, often include porting
35over work from other projects, mainly LLVM and GCC.
36
37Some general rules apply:
38
39- Copying work needs to adhere to the original license
40 - This applies to direct copy & paste
41 - This also applies to code you looked at and ported
42
43In general, taking inspiration from other codebases is fine, but please exercise caution when
44porting code.
45
46Ports of full libraries (e.g. C libraries shipped with LLVM) must keep the license of the original
47library.