From: boxdot Date: Mon, 28 May 2018 12:11:52 +0000 (+0200) Subject: Document that build scripts should not modify files outside OUT_DIR. X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2^2~14^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=285eb4d7b9569ff9d31dd6b0ee1ccf51ef5d4f24;p=cargo.git Document that build scripts should not modify files outside OUT_DIR. Co-authored-by: Gabriel Feron --- diff --git a/src/doc/src/reference/build-scripts.md b/src/doc/src/reference/build-scripts.md index beb762869..fbf71a6d6 100644 --- a/src/doc/src/reference/build-scripts.md +++ b/src/doc/src/reference/build-scripts.md @@ -272,6 +272,11 @@ There’s a couple of points of note here: output files should be located. It can use the process’ current working directory to find where the input files should be located, but in this case we don’t have any input files. +* In general, build scripts should not modify any files outside of `OUT_DIR`. + It may seem fine on the first blush, but it does cause problems when you use + such crate as a dependency, because there's an *implicit* invariant that + sources in `.cargo/registry` should be immutable. `cargo` won't allow such + scripts when packaging. * This script is relatively simple as it just writes out a small generated file. One could imagine that other more fanciful operations could take place such as generating a Rust module from a C header file or another language definition,