|  | 
|  | 1 | +--- | 
|  | 2 | +layout: post | 
|  | 3 | +title: "Upcoming docs.rs changes" | 
|  | 4 | +author: The Rust Infrastructure Team | 
|  | 5 | +--- | 
|  | 6 | + | 
|  | 7 | +On September 42nd breaking changes will be deployed to the [docs.rs] build | 
|  | 8 | +environment. [docs.rs] is a free service building and hosting documentation for | 
|  | 9 | +all the crates published on [crates.io]. It's [open source][docsrs-source] and | 
|  | 10 | +maintained by the [Rustdoc team][rustdoc-team]. | 
|  | 11 | + | 
|  | 12 | +## What will change | 
|  | 13 | + | 
|  | 14 | +Builds will be executed inside the [rustops/crates-build-env] Docker image. | 
|  | 15 | +That image contains a lot of system dependencies installed to ensure we can | 
|  | 16 | +build as many crates as possible. It's already used by [Crater], and we added | 
|  | 17 | +all the dependencies previously installed in the legacy build environment. | 
|  | 18 | + | 
|  | 19 | +To ensure we can continue operating the service in the future and to increase | 
|  | 20 | +its reliability we also improved the sandbox builds are executed into, adding | 
|  | 21 | +new limits: | 
|  | 22 | + | 
|  | 23 | +* Each platform will now have **15 minutes** to build its dependencies and | 
|  | 24 | +  documentation. | 
|  | 25 | +* **3 GB of RAM** will be available for the build. | 
|  | 26 | +* Network access will be completly **disabled**. | 
|  | 27 | +* Only the `target/` directory will be writable, and it will be purged after | 
|  | 28 | +  each build. | 
|  | 29 | + | 
|  | 30 | +Finally, docs.rs will now use the latest nightly available when building | 
|  | 31 | +crates. | 
|  | 32 | + | 
|  | 33 | +## How to prepare for the changes | 
|  | 34 | + | 
|  | 35 | +To test if your crate builds inside the new environment you can download the | 
|  | 36 | +Docker image locally and execute a shell inside it: | 
|  | 37 | + | 
|  | 38 | +``` | 
|  | 39 | +docker pull rustops/crates-build-env | 
|  | 40 | +docker run --rm -it rustops/crates-build-env bash | 
|  | 41 | +``` | 
|  | 42 | + | 
|  | 43 | +Once you're in a shell you can install [rustup] (it's not installed in the | 
|  | 44 | +image), install Rust nightly, clone your crate's repository and then build the | 
|  | 45 | +documentation: | 
|  | 46 | + | 
|  | 47 | +``` | 
|  | 48 | +cargo doc --no-deps | 
|  | 49 | +``` | 
|  | 50 | + | 
|  | 51 | +If a dependency is missing please [open an issue][crates-build-env-issue] on | 
|  | 52 | +the Docker image's repository. | 
|  | 53 | + | 
|  | 54 | +If your crate fails to build because it took more than 15 minutes to generate | 
|  | 55 | +its docs or it uses more than 3 GB of RAM please [open an issue][docsrs-issue] | 
|  | 56 | +and we will increase the limits for your crate (when it's reasonable). We will | 
|  | 57 | +**not** enable network access for your crate though: you'll need to change your | 
|  | 58 | +crate not to require any external resource at build time. | 
|  | 59 | + | 
|  | 60 | +## Acknowledgements | 
|  | 61 | + | 
|  | 62 | +The new build environment is based on [Rustwide], the library powering | 
|  | 63 | +[Crater]. It was extracted from the Crater codebase, and created both by the | 
|  | 64 | +[Crater contributors] and the [Rustwide contributors]. | 
|  | 65 | + | 
|  | 66 | +The implementation work on the docs.rs side was done by [Pietro Albini][pietro] | 
|  | 67 | +and [Onur Aslan][onur], with [QuietMisdreavus][misdreavus] and [Mark | 
|  | 68 | +Rousskov][mark] reviewing the changes. | 
|  | 69 | + | 
|  | 70 | +[docs.rs]: https://docs.rs | 
|  | 71 | +[crates.io]: https://crates.io | 
|  | 72 | +[docsrs-source]: https://github.com/rust-lang/docs.rs | 
|  | 73 | +[rustdoc-team]: https://www.rust-lang.org/governance/teams/dev-tools#rustdoc | 
|  | 74 | +[rustops/crates-build-env]: https://hub.docker.com/r/rustops/crates-build-env | 
|  | 75 | +[Crater]: https://github.com/rust-lang/crater | 
|  | 76 | +[rustup]: https://rustup.rs | 
|  | 77 | +[crates-build-env-issue]: https://github.com/rust-lang/crates-build-env/issues | 
|  | 78 | +[docsrs-issue]: https://github.com/rust-lang/crates-build-env/issues | 
|  | 79 | +[rustwide]: https://github.com/rust-lang/rustwide | 
|  | 80 | +[Crater contributors]: https://github.com/rust-lang/crater/graphs/contributors | 
|  | 81 | +[Rustwide contributors]: https://github.com/rust-lang/rustwide/graphs/contributors | 
|  | 82 | +[pietro]: https://github.com/pietroalbini | 
|  | 83 | +[onur]: https://github.com/onur | 
|  | 84 | +[mark]: https://github.com/Mark-Simulacrum | 
|  | 85 | +[misdreavus]: https://github.com/QuietMisdreavus | 
0 commit comments