Description
Spawned off of #13965.
Some of our tools generate, compile, and run code that has been written for e.g. documentation blocks. Sometimes those steps occur as part of standard make check
runs.
It can be annoying to developers if such steps generate side garbage in the local file system. It is especially annoying for developers who do not run make
in an isolated build directory, since then quite often it is the current working directory (i.e., their clone of the Rust repository) that gets garbage added to it.
It would be easy to say that the documentation writer was at fault for writing such a documentation block, or that another tool like rustdoc was at fault for not running "semi-trusted" code in an isolated semi-sandbox (i.e. a temporary directory).
But nonetheless, it seems like our Makefiles could guard against this, i.e. by taking a directory listing at the start of the build, and then comparing it against the directory listing at the end of the build, and filtering out the subdirectories that are known to be dedicated to build products, stamp files, logs, or temporary files.