Corey Farwell | d2cc79e | 2020-12-23 19:17:34 | [diff] [blame] | 1 | # The Rust Programming Language |
| 2 | |
Peter Atashian | be43c65 | 2016-06-27 17:51:27 | [diff] [blame] | 3 | This is the main source code repository for [Rust]. It contains the compiler, |
Andreas Jonson | 30659cd | 2020-07-19 14:53:37 | [diff] [blame] | 4 | standard library, and documentation. |
Nick Hamann | 74f1818 | 2015-05-15 05:43:40 | [diff] [blame] | 5 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 6 | [Rust]: https://www.rust-lang.org/ |
Tshepang Lekhonkhobe | a8680de | 2015-06-18 21:48:51 | [diff] [blame] | 7 | |
Gimbles | 93ebf46 | 2022-12-24 15:48:35 | [diff] [blame] | 8 | **Note: this README is for _users_ rather than _contributors_.** |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 9 | If you wish to _contribute_ to the compiler, you should read |
| 10 | [CONTRIBUTING.md](CONTRIBUTING.md) instead. |
mark | 3f6928f | 2020-06-17 19:25:00 | [diff] [blame] | 11 | |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 12 | ## Quick Start |
Brian Anderson | c92d2ed | 2012-07-10 05:13:48 | [diff] [blame] | 13 | |
Fuqiao Xue | 09ac478 | 2017-06-09 05:37:22 | [diff] [blame] | 14 | Read ["Installation"] from [The Book]. |
Austin Seipp | 62c4d2c | 2012-01-23 21:53:12 | [diff] [blame] | 15 | |
misagh | 3d23e55 | 2018-12-10 22:28:55 | [diff] [blame] | 16 | ["Installation"]: https://doc.rust-lang.org/book/ch01-01-installation.html |
Eli Friedman | bbbfed2 | 2015-08-09 21:15:05 | [diff] [blame] | 17 | [The Book]: https://doc.rust-lang.org/book/index.html |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 18 | |
Who? Me?! | 0c4602a | 2019-01-18 21:28:23 | [diff] [blame] | 19 | ## Installing from Source |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 20 | |
Anirban | 22fc18f | 2020-06-25 10:59:37 | [diff] [blame] | 21 | The Rust build system uses a Python script called `x.py` to build the compiler, |
zahash | 5b758f0 | 2022-09-11 11:09:19 | [diff] [blame] | 22 | which manages the bootstrapping process. It lives at the root of the project. |
Lee Bradley | 4c12a5d | 2021-05-18 05:33:17 | [diff] [blame] | 23 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 24 | The `x.py` command can be run directly on most Unix systems in the following |
| 25 | format: |
Lee Bradley | 4c12a5d | 2021-05-18 05:33:17 | [diff] [blame] | 26 | |
| 27 | ```sh |
| 28 | ./x.py <subcommand> [flags] |
| 29 | ``` |
| 30 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 31 | This is how the documentation and examples assume you are running `x.py`. |
| 32 | Some alternative ways are: |
Lee Bradley | 4c12a5d | 2021-05-18 05:33:17 | [diff] [blame] | 33 | |
| 34 | ```sh |
KaDiWa | 9bf4036 | 2022-12-25 23:33:32 | [diff] [blame] | 35 | # On a Unix shell if you don't have the necessary `python3` command |
| 36 | ./x <subcommand> [flags] |
Lee Bradley | 4c12a5d | 2021-05-18 05:33:17 | [diff] [blame] | 37 | |
KaDiWa | 9bf4036 | 2022-12-25 23:33:32 | [diff] [blame] | 38 | # On the Windows Command Prompt (if .py files are configured to run Python) |
| 39 | x.py <subcommand> [flags] |
| 40 | |
| 41 | # You can also run Python yourself, e.g.: |
| 42 | python x.py <subcommand> [flags] |
Lee Bradley | 4c12a5d | 2021-05-18 05:33:17 | [diff] [blame] | 43 | ``` |
| 44 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 45 | More information about `x.py` can be found by running it with the `--help` flag |
| 46 | or reading the [rustc dev guide][rustcguidebuild]. |
Eric Huss | 06c3256 | 2019-07-09 23:12:41 | [diff] [blame] | 47 | |
Valentin | df43dcd | 2020-07-03 09:42:12 | [diff] [blame] | 48 | [gettingstarted]: https://rustc-dev-guide.rust-lang.org/getting-started.html |
Santiago Pastorino | b3b32b7 | 2020-03-09 21:33:04 | [diff] [blame] | 49 | [rustcguidebuild]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html |
Who? Me?! | 0c4602a | 2019-01-18 21:28:23 | [diff] [blame] | 50 | |
Joshua Nelson | 7dae1b0 | 2022-12-24 01:03:50 | [diff] [blame] | 51 | ### Dependencies |
Kevin Yap | 24fa6be | 2015-02-21 22:46:06 | [diff] [blame] | 52 | |
Joshua Nelson | 7dae1b0 | 2022-12-24 01:03:50 | [diff] [blame] | 53 | Make sure you have installed the dependencies: |
| 54 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 55 | * `python` 3 or 2.7 |
| 56 | * `git` |
| 57 | * A C compiler (when building for the host, `cc` is enough; cross-compiling may |
| 58 | need additional compilers) |
| 59 | * `curl` (not needed on Windows) |
| 60 | * `pkg-config` if you are compiling on Linux and targeting Linux |
| 61 | * `libiconv` (already included with glibc on Debian-based distros) |
Steve Klabnik | f645cad | 2015-02-13 17:26:44 | [diff] [blame] | 62 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 63 | To build Cargo, you'll also need OpenSSL (`libssl-dev` or `openssl-devel` on |
| 64 | most Unix distros). |
Joshua Nelson | 7dae1b0 | 2022-12-24 01:03:50 | [diff] [blame] | 65 | |
| 66 | If building LLVM from source, you'll need additional tools: |
| 67 | |
| 68 | * `g++`, `clang++`, or MSVC with versions listed on |
| 69 | [LLVM's documentation](https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library) |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 70 | * `ninja`, or GNU `make` 3.81 or later (Ninja is recommended, especially on |
| 71 | Windows) |
Joshua Nelson | 7dae1b0 | 2022-12-24 01:03:50 | [diff] [blame] | 72 | * `cmake` 3.13.4 or later |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 73 | * `libstdc++-static` may be required on some Linux distributions such as Fedora |
| 74 | and Ubuntu |
Joshua Nelson | 7dae1b0 | 2022-12-24 01:03:50 | [diff] [blame] | 75 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 76 | On tier 1 or tier 2 with host tools platforms, you can also choose to download |
| 77 | LLVM by setting `llvm.download-ci-llvm = true`. |
Joshua Nelson | 7dae1b0 | 2022-12-24 01:03:50 | [diff] [blame] | 78 | Otherwise, you'll need LLVM installed and `llvm-config` in your path. |
| 79 | See [the rustc-dev-guide for more info][sysllvm]. |
| 80 | |
| 81 | [sysllvm]: https://rustc-dev-guide.rust-lang.org/building/new-target.html#using-pre-built-llvm |
| 82 | |
| 83 | |
| 84 | ### Building on a Unix-like system |
| 85 | |
| 86 | 1. Clone the [source] with `git`: |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 87 | |
Kevin Yap | 24fa6be | 2015-02-21 22:46:06 | [diff] [blame] | 88 | ```sh |
qlcom | 18ce4c1 | 2020-09-18 15:08:48 | [diff] [blame] | 89 | git clone https://github.com/rust-lang/rust.git |
| 90 | cd rust |
Kevin Yap | 24fa6be | 2015-02-21 22:46:06 | [diff] [blame] | 91 | ``` |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 92 | |
Brian Anderson | 4acc483 | 2015-02-16 04:20:25 | [diff] [blame] | 93 | [source]: https://github.com/rust-lang/rust |
| 94 | |
Joshua Nelson | 7dae1b0 | 2022-12-24 01:03:50 | [diff] [blame] | 95 | 2. Configure the build settings: |
Eric Huss | 06c3256 | 2019-07-09 23:12:41 | [diff] [blame] | 96 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 97 | The Rust build system uses a file named `config.toml` in the root of the |
| 98 | source tree to determine various configuration settings for the build. |
| 99 | Set up the defaults intended for distros to get started. You can see a full |
| 100 | list of options in `config.toml.example`. |
Adrien Tétar | a30d61b | 2014-01-11 14:19:38 | [diff] [blame] | 101 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 102 | ```sh |
| 103 | printf 'profile = "user" \nchangelog-seen = 2 \n' > config.toml |
| 104 | ``` |
Adrien Tétar | a30d61b | 2014-01-11 14:19:38 | [diff] [blame] | 105 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 106 | If you plan to use `x.py install` to create an installation, it is |
| 107 | recommended that you set the `prefix` value in the `[install]` section to a |
| 108 | directory. |
Eddie Kovsky | 71dfb01 | 2019-03-21 04:21:53 | [diff] [blame] | 109 | |
Joshua Nelson | 7dae1b0 | 2022-12-24 01:03:50 | [diff] [blame] | 110 | 3. Build and install: |
Eric Huss | 06c3256 | 2019-07-09 23:12:41 | [diff] [blame] | 111 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 112 | ```sh |
| 113 | ./x.py build && ./x.py install |
| 114 | ``` |
Eddie Kovsky | 71dfb01 | 2019-03-21 04:21:53 | [diff] [blame] | 115 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 116 | When complete, `./x.py install` will place several programs into |
| 117 | `$PREFIX/bin`: `rustc`, the Rust compiler, and `rustdoc`, the |
| 118 | API-documentation tool. If you've set `profile = "user"` or |
| 119 | `build.extended = true`, it will also include [Cargo], Rust's package |
| 120 | manager. |
Brian Anderson | 21ed20b | 2015-02-16 04:41:16 | [diff] [blame] | 121 | |
| 122 | [Cargo]: https://github.com/rust-lang/cargo |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 123 | |
Luqman Aden | 8b83355 | 2014-06-27 00:07:44 | [diff] [blame] | 124 | ### Building on Windows |
Luqman Aden | 8b83355 | 2014-06-27 00:07:44 | [diff] [blame] | 125 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 126 | On Windows, we suggest using [winget] to install dependencies by running the |
| 127 | following in a terminal: |
Joshua Nelson | 7dae1b0 | 2022-12-24 01:03:50 | [diff] [blame] | 128 | |
| 129 | ```powershell |
| 130 | winget install -e Python.Python.3 |
| 131 | winget install -e Kitware.CMake |
| 132 | winget install -e Git.Git |
| 133 | ``` |
| 134 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 135 | Then edit your system's `PATH` variable and add: `C:\Program Files\CMake\bin`. |
| 136 | See |
| 137 | [this guide on editing the system `PATH`](https://www.java.com/en/download/help/path.html) |
| 138 | from the Java documentation. |
Joshua Nelson | 7dae1b0 | 2022-12-24 01:03:50 | [diff] [blame] | 139 | |
| 140 | [winget]: https://github.com/microsoft/winget-cli |
| 141 | |
Steve Klabnik | 011a23e | 2016-01-04 17:33:43 | [diff] [blame] | 142 | There are two prominent ABIs in use on Windows: the native (MSVC) ABI used by |
zahash | 5b758f0 | 2022-09-11 11:09:19 | [diff] [blame] | 143 | Visual Studio and the GNU ABI used by the GCC toolchain. Which version of Rust |
| 144 | you need depends largely on what C/C++ libraries you want to interoperate with. |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 145 | Use the MSVC build of Rust to interop with software produced by Visual Studio |
| 146 | and the GNU build to interop with GNU software built using the MinGW/MSYS2 |
| 147 | toolchain. |
Steve Klabnik | 011a23e | 2016-01-04 17:33:43 | [diff] [blame] | 148 | |
Steve Klabnik | 011a23e | 2016-01-04 17:33:43 | [diff] [blame] | 149 | #### MinGW |
Steve Klabnik | 011a23e | 2016-01-04 17:33:43 | [diff] [blame] | 150 | |
Alex Crichton | cb74a58 | 2016-06-27 23:02:06 | [diff] [blame] | 151 | [MSYS2][msys2] can be used to easily build Rust on Windows: |
Luqman Aden | 8b83355 | 2014-06-27 00:07:44 | [diff] [blame] | 152 | |
Trevor Spiteri | 3a3e7eb | 2021-03-10 07:41:53 | [diff] [blame] | 153 | [msys2]: https://www.msys2.org/ |
Luqman Aden | 8b83355 | 2014-06-27 00:07:44 | [diff] [blame] | 154 | |
zahash | 5b758f0 | 2022-09-11 11:09:19 | [diff] [blame] | 155 | 1. Download the latest [MSYS2 installer][msys2] and go through the installer. |
Alex Crichton | cb74a58 | 2016-06-27 23:02:06 | [diff] [blame] | 156 | |
zahash | 5b758f0 | 2022-09-11 11:09:19 | [diff] [blame] | 157 | 2. Run `mingw32_shell.bat` or `mingw64_shell.bat` from the MSYS2 installation |
zahash | a91e618 | 2022-09-11 15:45:55 | [diff] [blame] | 158 | directory (e.g. `C:\msys64`), depending on whether you want 32-bit or 64-bit |
Alex Crichton | cb74a58 | 2016-06-27 23:02:06 | [diff] [blame] | 159 | Rust. (As of the latest version of MSYS2 you have to run `msys2_shell.cmd |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 160 | -mingw32` or `msys2_shell.cmd -mingw64` from the command line instead.) |
Alex Crichton | cb74a58 | 2016-06-27 23:02:06 | [diff] [blame] | 161 | |
| 162 | 3. From this terminal, install the required tools: |
Luqman Aden | 8b83355 | 2014-06-27 00:07:44 | [diff] [blame] | 163 | |
Kevin Yap | 24fa6be | 2015-02-21 22:46:06 | [diff] [blame] | 164 | ```sh |
Jake Shadle | 371c0ea | 2015-08-28 07:46:23 | [diff] [blame] | 165 | # Update package mirrors (may be needed if you have a fresh install of MSYS2) |
qlcom | 18ce4c1 | 2020-09-18 15:08:48 | [diff] [blame] | 166 | pacman -Sy pacman-mirrors |
Alex Crichton | cb74a58 | 2016-06-27 23:02:06 | [diff] [blame] | 167 | |
| 168 | # Install build tools needed for Rust. If you're building a 32-bit compiler, |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 169 | # then replace "x86_64" below with "i686". If you've already got Git, Python, |
| 170 | # or CMake installed and in PATH you can remove them from this list. |
| 171 | # Note that it is important that you do **not** use the 'python2', 'cmake', |
| 172 | # and 'ninja' packages from the 'msys2' subsystem. |
| 173 | # The build has historically been known to fail with these packages. |
qlcom | 18ce4c1 | 2020-09-18 15:08:48 | [diff] [blame] | 174 | pacman -S git \ |
Alex Crichton | cb74a58 | 2016-06-27 23:02:06 | [diff] [blame] | 175 | make \ |
| 176 | diffutils \ |
Danny Hua | 2ebef83 | 2016-10-14 02:38:49 | [diff] [blame] | 177 | tar \ |
Guillaume Gomez | 38eb369 | 2019-11-21 12:57:40 | [diff] [blame] | 178 | mingw-w64-x86_64-python \ |
Alex Crichton | cb74a58 | 2016-06-27 23:02:06 | [diff] [blame] | 179 | mingw-w64-x86_64-cmake \ |
CDirkx | 00d459a | 2020-08-30 23:22:25 | [diff] [blame] | 180 | mingw-w64-x86_64-gcc \ |
| 181 | mingw-w64-x86_64-ninja |
Steve Klabnik | 011a23e | 2016-01-04 17:33:43 | [diff] [blame] | 182 | ``` |
Carlos Liam | 3967e1c | 2015-10-06 15:14:11 | [diff] [blame] | 183 | |
Josh Driver | fb2d763 | 2017-02-23 10:45:30 | [diff] [blame] | 184 | 4. Navigate to Rust's source code (or clone it), then build it: |
Kevin Yap | 24fa6be | 2015-02-21 22:46:06 | [diff] [blame] | 185 | |
| 186 | ```sh |
qlcom | 18ce4c1 | 2020-09-18 15:08:48 | [diff] [blame] | 187 | ./x.py build && ./x.py install |
Kevin Yap | 24fa6be | 2015-02-21 22:46:06 | [diff] [blame] | 188 | ``` |
Bryce Van Dyk | ee24add | 2015-10-22 08:52:17 | [diff] [blame] | 189 | |
Steve Klabnik | 011a23e | 2016-01-04 17:33:43 | [diff] [blame] | 190 | #### MSVC |
Steve Klabnik | 011a23e | 2016-01-04 17:33:43 | [diff] [blame] | 191 | |
Scott McMurray | 7171bd1 | 2019-05-14 04:54:47 | [diff] [blame] | 192 | MSVC builds of Rust additionally require an installation of Visual Studio 2017 |
Tushar Dahiya | 9397b6c | 2022-08-23 17:57:23 | [diff] [blame] | 193 | (or later) so `rustc` can use its linker. The simplest way is to get |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 194 | [Visual Studio], check the "C++ build tools" and "Windows 10 SDK" workload. |
Scott McMurray | 7171bd1 | 2019-05-14 04:54:47 | [diff] [blame] | 195 | |
Sunreal | 3d6070d | 2019-06-07 16:14:52 | [diff] [blame] | 196 | [Visual Studio]: https://visualstudio.microsoft.com/downloads/ |
Scott McMurray | 7171bd1 | 2019-05-14 04:54:47 | [diff] [blame] | 197 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 198 | (If you're installing CMake yourself, be careful that "C++ CMake tools for |
| 199 | Windows" doesn't get included under "Individual components".) |
Steve Klabnik | 011a23e | 2016-01-04 17:33:43 | [diff] [blame] | 200 | |
Alex Crichton | 0e272de | 2016-11-16 20:31:19 | [diff] [blame] | 201 | With these dependencies installed, you can build the compiler in a `cmd.exe` |
| 202 | shell with: |
Steve Klabnik | 011a23e | 2016-01-04 17:33:43 | [diff] [blame] | 203 | |
| 204 | ```sh |
qlcom | 18ce4c1 | 2020-09-18 15:08:48 | [diff] [blame] | 205 | python x.py build |
Alex Crichton | 0e272de | 2016-11-16 20:31:19 | [diff] [blame] | 206 | ``` |
| 207 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 208 | Right now, building Rust only works with some known versions of Visual Studio. |
| 209 | If you have a more recent version installed and the build system doesn't |
| 210 | understand, you may need to force rustbuild to use an older version. |
| 211 | This can be done by manually calling the appropriate vcvars file before running |
| 212 | the bootstrap. |
Alex Crichton | b67f23c | 2016-07-06 18:35:33 | [diff] [blame] | 213 | |
Behnam Esfahbod | 88fe8ac | 2018-09-09 03:02:50 | [diff] [blame] | 214 | ```batch |
qlcom | 18ce4c1 | 2020-09-18 15:08:48 | [diff] [blame] | 215 | CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" |
| 216 | python x.py build |
Peter Atashian | be43c65 | 2016-06-27 17:51:27 | [diff] [blame] | 217 | ``` |
| 218 | |
Josh Driver | fb2d763 | 2017-02-23 10:45:30 | [diff] [blame] | 219 | #### Specifying an ABI |
Josh Driver | fb2d763 | 2017-02-23 10:45:30 | [diff] [blame] | 220 | |
| 221 | Each specific ABI can also be used from either environment (for example, using |
Dhirendra Kumar Kashyap | 3eaa4a3 | 2018-06-13 17:23:50 | [diff] [blame] | 222 | the GNU ABI in PowerShell) by using an explicit build triple. The available |
Josh Driver | fb2d763 | 2017-02-23 10:45:30 | [diff] [blame] | 223 | Windows build triples are: |
| 224 | - GNU ABI (using GCC) |
| 225 | - `i686-pc-windows-gnu` |
| 226 | - `x86_64-pc-windows-gnu` |
| 227 | - The MSVC ABI |
| 228 | - `i686-pc-windows-msvc` |
| 229 | - `x86_64-pc-windows-msvc` |
| 230 | |
Matt Ickstadt | 081f32a | 2017-08-22 18:28:39 | [diff] [blame] | 231 | The build triple can be specified by either specifying `--build=<triple>` when |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 232 | invoking `x.py` commands, or by creating a `config.toml` file (as described in |
| 233 | [Installing from Source](#installing-from-source)), and modifying the `build` |
| 234 | option under the `[build]` section. |
Josh Driver | fb2d763 | 2017-02-23 10:45:30 | [diff] [blame] | 235 | |
| 236 | ### Configure and Make |
Josh Driver | fb2d763 | 2017-02-23 10:45:30 | [diff] [blame] | 237 | |
| 238 | While it's not the recommended build system, this project also provides a |
| 239 | configure script and makefile (the latter of which just invokes `x.py`). |
| 240 | |
| 241 | ```sh |
qlcom | 18ce4c1 | 2020-09-18 15:08:48 | [diff] [blame] | 242 | ./configure |
| 243 | make && sudo make install |
Josh Driver | fb2d763 | 2017-02-23 10:45:30 | [diff] [blame] | 244 | ``` |
| 245 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 246 | `configure` generates a `config.toml` which can also be used with normal `x.py` |
| 247 | invocations. |
Josh Driver | fb2d763 | 2017-02-23 10:45:30 | [diff] [blame] | 248 | |
Steve Klabnik | fd53ea2 | 2015-08-18 17:49:20 | [diff] [blame] | 249 | ## Building Documentation |
Steve Klabnik | fd53ea2 | 2015-08-18 17:49:20 | [diff] [blame] | 250 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 251 | If you'd like to build the documentation, it's almost the same: |
Steve Klabnik | fd53ea2 | 2015-08-18 17:49:20 | [diff] [blame] | 252 | |
| 253 | ```sh |
qlcom | 18ce4c1 | 2020-09-18 15:08:48 | [diff] [blame] | 254 | ./x.py doc |
Steve Klabnik | fd53ea2 | 2015-08-18 17:49:20 | [diff] [blame] | 255 | ``` |
| 256 | |
projektir | 6b7b262 | 2017-03-13 05:01:32 | [diff] [blame] | 257 | The generated documentation will appear under `doc` in the `build` directory for |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 258 | the ABI used. That is, if the ABI was `x86_64-pc-windows-msvc`, the directory |
| 259 | will be `build\x86_64-pc-windows-msvc\doc`. |
Steve Klabnik | fd53ea2 | 2015-08-18 17:49:20 | [diff] [blame] | 260 | |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 261 | ## Notes |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 262 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 263 | Since the Rust compiler is written in Rust, it must be built by a precompiled |
| 264 | "snapshot" version of itself (made in an earlier stage of development). |
| 265 | As such, source builds require an Internet connection to fetch snapshots, and an |
| 266 | OS that can execute the available snapshot binaries. |
Austin Seipp | 62c4d2c | 2012-01-23 21:53:12 | [diff] [blame] | 267 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 268 | See https://doc.rust-lang.org/nightly/rustc/platform-support.html for a list of |
| 269 | supported platforms. |
| 270 | Only "host tools" platforms have a pre-compiled snapshot binary available; to |
| 271 | compile for a platform without host tools you must cross-compile. |
Austin Seipp | 62c4d2c | 2012-01-23 21:53:12 | [diff] [blame] | 272 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 273 | You may find that other platforms work, but these are our officially supported |
| 274 | build environments that are most likely to work. |
Austin Seipp | 62c4d2c | 2012-01-23 21:53:12 | [diff] [blame] | 275 | |
Kevin Yap | 24fa6be | 2015-02-21 22:46:06 | [diff] [blame] | 276 | ## Getting Help |
Brian Anderson | cd1fabe | 2014-08-22 18:04:35 | [diff] [blame] | 277 | |
Joshua Nelson | a06e5de | 2022-12-24 01:03:50 | [diff] [blame] | 278 | See https://www.rust-lang.org/community for a list of chat platforms and forums. |
Steve Klabnik | f645cad | 2015-02-13 17:26:44 | [diff] [blame] | 279 | |
| 280 | ## Contributing |
Steve Klabnik | f645cad | 2015-02-13 17:26:44 | [diff] [blame] | 281 | |
Joshua Nelson | a06e5de | 2022-12-24 01:03:50 | [diff] [blame] | 282 | See [CONTRIBUTING.md](CONTRIBUTING.md). |
Camelid | 8783c62 | 2020-09-02 00:48:15 | [diff] [blame] | 283 | |
Brian Anderson | c92d2ed | 2012-07-10 05:13:48 | [diff] [blame] | 284 | ## License |
Austin Seipp | 62c4d2c | 2012-01-23 21:53:12 | [diff] [blame] | 285 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 286 | Rust is primarily distributed under the terms of both the MIT license and the |
| 287 | Apache License (Version 2.0), with portions covered by various BSD-like |
| 288 | licenses. |
Austin Seipp | 62c4d2c | 2012-01-23 21:53:12 | [diff] [blame] | 289 | |
Peter Atashian | be43c65 | 2016-06-27 17:51:27 | [diff] [blame] | 290 | See [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT), and |
| 291 | [COPYRIGHT](COPYRIGHT) for details. |
Andrew Xu | 8ffb6fd | 2019-04-06 10:04:06 | [diff] [blame] | 292 | |
| 293 | ## Trademark |
Andrew Xu | 8ffb6fd | 2019-04-06 10:04:06 | [diff] [blame] | 294 | |
Liigo Zhuang | 9c65f9f | 2021-05-26 02:51:13 | [diff] [blame] | 295 | [The Rust Foundation][rust-foundation] owns and protects the Rust and Cargo |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 296 | trademarks and logos (the "Rust Trademarks"). |
Andrew Xu | 8ffb6fd | 2019-04-06 10:04:06 | [diff] [blame] | 297 | |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 298 | If you want to use these names or brands, please read the |
| 299 | [media guide][media-guide]. |
Andrew Xu | 8ffb6fd | 2019-04-06 10:04:06 | [diff] [blame] | 300 | |
Andrew Xu | 98beb12 | 2019-04-12 14:14:21 | [diff] [blame] | 301 | Third-party logos may be subject to third-party copyrights and trademarks. See |
| 302 | [Licenses][policies-licenses] for details. |
| 303 | |
Liigo Zhuang | 2caaa07 | 2021-05-20 10:11:01 | [diff] [blame] | 304 | [rust-foundation]: https://foundation.rust-lang.org/ |
Alex Touchet | 8915ba7 | 2022-12-29 05:47:09 | [diff] [blame^] | 305 | [media-guide]: https://foundation.rust-lang.org/policies/logo-policy-and-media-guide/ |
Andrew Xu | 98beb12 | 2019-04-12 14:14:21 | [diff] [blame] | 306 | [policies-licenses]: https://www.rust-lang.org/policies/licenses |