# Are \[env\] blocks documented anywhere?

**URL:** <https://internals.rust-lang.org/t/are-env-blocks-documented-anywhere/21657>\
**Category:** documentation\
**Created:** [October 5, 2024, 11:24pm UTC](https://internals.rust-lang.org/t/are-env-blocks-documented-anywhere/21657 "2024-10-05T23:24:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![garagedragon](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/garagedragon/32/5799_2.png) [@garagedragon](https://internals.rust-lang.org/u/garagedragon)\
**Post date:** [October 5, 2024, 11:24pm UTC](https://internals.rust-lang.org/t/are-env-blocks-documented-anywhere/21657/1 "2024-10-05T23:24:03Z")

</div>

While doing some digging, I [discovered](https://github.com/rust-lang/cargo/pull/9175) that it is possible for a crate to define environment variables in its subprocesses including its dependent crates, and apparently [this has been stable](https://github.com/rust-lang/cargo/pull/9411) for a number of years.

However, I can't find any mention of this in The Book, either in the section talking about the manifest format or how environment variables work - the latter section only talks about the ones Cargo itself sets up.

I just wanted to check that this is really not there and I'm not just missing something before I started looking into how to submit a correction

---

<div class="post-metadata">

**Author:** ![jrose](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/jrose/32/9591_2.png) [@jrose](https://internals.rust-lang.org/u/jrose)\
**Post date:** [October 6, 2024, 1:11am UTC](https://internals.rust-lang.org/t/are-env-blocks-documented-anywhere/21657/2 "2024-10-06T01:11:47Z")

</div>

This is config.toml, not Cargo.toml. It’s documented here: [Configuration - The Cargo Book](https://doc.rust-lang.org/cargo/reference/config.html#env)

…but it doesn’t apply to dependent crates, it applies to the current workspace. Which dependents won’t be building from. Sorry!

---

<div class="post-metadata">

**Author:** ![garagedragon](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/garagedragon/32/5799_2.png) [@garagedragon](https://internals.rust-lang.org/u/garagedragon)\
**Post date:** [October 6, 2024, 5:33pm UTC](https://internals.rust-lang.org/t/are-env-blocks-documented-anywhere/21657/3 "2024-10-06T17:33:09Z")

</div>

Argh, I specifically saw it in the context of feeding information upstream, but I must have misunderstood the context of building external library crates

---

<div class="post-metadata">

**Author:** ![steffahn](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/steffahn/32/13288_2.png) [@steffahn](https://internals.rust-lang.org/u/steffahn)\
**Post date:** [March 30, 2026, 5:33pm UTC](https://internals.rust-lang.org/t/are-env-blocks-documented-anywhere/21657/4 "2026-03-30T17:33:58Z")

</div>

Closed on March 30, 2026, 5:33pm UTC

This topic was automatically closed 540 days after the last reply. New replies are no longer allowed.
