@@ -255,7 +255,8 @@ corresponding environment variable is set to the empty string, `""`.
255255 file extension, such as ` .exe ` .
256256* ` OUT_DIR ` --- If the package has a build script, this is set to the folder
257257 where the build script should place its output. See below for more information.
258- (Only set during compilation.)
258+ (Only set during compilation.) Cargo does not guarantee that this directory
259+ is empty, and it is not cleaned between builds.
259260* ` CARGO_BIN_EXE_<name> ` --- The absolute path to a binary target's executable.
260261 This is only set when building an [ integration test] or benchmark. This may
261262 be used with the [ ` env ` macro] to find the executable to run for testing
@@ -366,7 +367,10 @@ let out_dir = env::var("OUT_DIR").unwrap();
366367 > Some cfg values like ` test ` are not available.
367368* ` OUT_DIR ` --- the folder in which all output and intermediate artifacts should
368369 be placed. This folder is inside the build directory for the package being built,
369- and it is unique for the package in question.
370+ and it is unique for the package in question. Cargo does not clean or reset this
371+ directory between builds, and its contents may persist across rebuilds. Build
372+ scripts should not assume that ` OUT_DIR ` is empty, and are responsible for
373+ managing or cleaning up any files they create.
370374* ` TARGET ` --- the target triple that is being compiled for. Native code should be
371375 compiled for this triple. See the [ Target Triple] description for more information.
372376* ` HOST ` --- the host triple of the Rust compiler.
0 commit comments