about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/errors.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-04-14 21:11:11 +0200
committerGitHub <noreply@github.com>2023-04-14 21:11:11 +0200
commit13790bec6a8b939c91b76a0ef8fbeecb9d9f5a8f (patch)
tree7a79b5bfef0dddfb0f3d1373f35b785f9a9cbae9 /compiler/rustc_codegen_llvm/src/errors.rs
parent7bfccb3d7f413821b1fbeb044a2d35b3bf4a035e (diff)
parente612d785d75b84832725f3c265592c0e512f2ed3 (diff)
downloadrust-13790bec6a8b939c91b76a0ef8fbeecb9d9f5a8f.tar.gz
rust-13790bec6a8b939c91b76a0ef8fbeecb9d9f5a8f.zip
Rollup merge of #109272 - schneems:schneems/add-docs-to-command-env-methods, r=Amanieu
Add Command environment variable inheritance docs

The interaction between the environment variable methods can be confusing. Specifically `env_clear` and `remove_env` have a side effects not mentioned: they disable inheriting environment variables from the parent process. I wanted to fully document this behavior as well as explain relevant edge cases in each of the `Command` env methods.

This is further confused by the return of `get_envs` which will return key/None if `remove_env` has been used, but an empty iterator if `env_clear` has been called. Or a non-empty iterator if `env_clear` was called and later explicit mappings are added. Currently there is no way (that I'm able to find) of observing whether or not the internal `env_clear=true` been toggled on the `Command` struct via its public API.

Ultimately environment variable mappings can be in one of several states:

- Explicitly set value (via `envs` / `env`) will take precedence over parent mapping
- Not explicitly set, will inherit mapping from parent
- Explicitly removed via `remove_env`, this single mapping will not inherit from parent
- Implicitly removed via `env_clear`, no mappings will inherit from parent

I tried to represent this in the relevant sections of the docs.

This is my second-ever doc PR (whoop!). I'm happy to take specific or general doc feedback. Also happy to explain the logic behind any changes or additions I made.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/errors.rs')
0 files changed, 0 insertions, 0 deletions