From 285eb4d7b9569ff9d31dd6b0ee1ccf51ef5d4f24 Mon Sep 17 00:00:00 2001 From: boxdot Date: Mon, 28 May 2018 14:11:52 +0200 Subject: [PATCH] Document that build scripts should not modify files outside OUT_DIR. Co-authored-by: Gabriel Feron --- src/doc/src/reference/build-scripts.md | 5 +++++ 1 file changed, 5 insertions(+) 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, -- 2.30.2