Skip to content

Commit

Permalink
Add (unstable) documentation for --env command line option
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Nov 27, 2023
1 parent bafdbae commit 28a7a39
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/doc/unstable-book/src/compiler-flags/env.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# `env`

The tracking issue for this feature is: [#118372](https://github.com/rust-lang/rust/issues/118372).

------------------------

This option flag allows to specify environment variables value at compile time to be
used by `env!` and `option_env!` macros.

When retrieving and environment variable value, the one specified by `--env` will take
precedence. For example if you want have `PATH=a` in your environment and pass:

```bash
rustc --env PATH=env
```

Then you will have:

```rust
assert_eq!(env!("PATH"), "env");
```

0 comments on commit 28a7a39

Please sign in to comment.