# Stabilize --env-set command line

**URL:** <https://internals.rust-lang.org/t/stabilize-env-set-command-line/23633>\
**Category:** Uncategorized\
**Created:** [October 19, 2025, 8:12pm UTC](https://internals.rust-lang.org/t/stabilize-env-set-command-line/23633 "2025-10-19T20:12:45Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![xclaesse](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/xclaesse/32/13711_2.png) [@xclaesse](https://internals.rust-lang.org/u/xclaesse)\
**Post date:** [October 19, 2025, 8:12pm UTC](https://internals.rust-lang.org/t/stabilize-env-set-command-line/23633/1 "2025-10-19T20:12:45Z")

</div>

The PR to stabilize --env-set has been closed 2 years ago with no real explanation: [Stabilize `--env-set` option by GuillaumeGomez · Pull Request #119926 · rust-lang/rust · GitHub](https://github.com/rust-lang/rust/pull/119926).

That feature is still very much needed for build systems that cannot easily set environment variables when invoking compiler command (anything using Ninja, like Meson).

What's missing to make it move forward?

---

<div class="post-metadata">

**Author:** ![kpreid](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/kpreid/32/8484_2.png) [@kpreid](https://internals.rust-lang.org/u/kpreid)\
**Post date:** [October 19, 2025, 8:42pm UTC](https://internals.rust-lang.org/t/stabilize-env-set-command-line/23633/2 "2025-10-19T20:42:34Z")

</div>

I’m not at all familiar with this feature, but from skimming the comments on the PR, it seems that what is needed is:

- A more thorough stabilization report; this would include such things as descriptions of **successfully** using the unstable feature in third-party build systems. (The thing being defended against here is stabilizing something that doesn’t actually help users because it was incorrectly designed; the stabilization report should be the evidence that the feature actually works for this purpose.)

- A resolution of the [concern](https://github.com/rust-lang/rust/pull/119926#issuecomment-1900703005) about how this option interacts with the compiler reading environment variables itself — that would constitute both documenting what such behaviors are, and changing it if it is currently bad.

---

<div class="post-metadata">

**Author:** ![xclaesse](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/xclaesse/32/13711_2.png) [@xclaesse](https://internals.rust-lang.org/u/xclaesse)\
**Post date:** [October 19, 2025, 8:51pm UTC](https://internals.rust-lang.org/t/stabilize-env-set-command-line/23633/3 "2025-10-19T20:51:30Z")

</div>

Thanks for your reply.

It has been successfully used in Meson, see [Stabilize `--env-set` option by GuillaumeGomez · Pull Request #119926 · rust-lang/rust · GitHub](https://github.com/rust-lang/rust/pull/119926#issuecomment-1894571539). It's waiting for the feature to be stabilized in rustc for before merging, and surely needs a big rebased since it's 2 years old. But I think that validates the concept.

About the compiler reading environment variables itself, I believe that's unrelated and --env-set should not affect that, but I'm not a Rust dev so I cannot really judge. I commented on the PR as well.

---

<div class="post-metadata">

**Author:** ![kpreid](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/kpreid/32/8484_2.png) [@kpreid](https://internals.rust-lang.org/u/kpreid)\
**Post date:** [October 19, 2025, 9:02pm UTC](https://internals.rust-lang.org/t/stabilize-env-set-command-line/23633/4 "2025-10-19T21:02:34Z")

</div>

The reason I list the things I do is because the most effective way to get something stabilized is to figure out what will address the concerns, and send PRs as needed.

> [@xclaesse](#):
>
> About the compiler reading environment variables itself, I believe that's unrelated and --env-set should not affect that,

Then the thing that needs doing is to update the documentation, and the implementation if needed, so that that is in fact what `--env-set` does, and is documented as doing.

---

<div class="post-metadata">

**Author:** ![xclaesse](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/xclaesse/32/13711_2.png) [@xclaesse](https://internals.rust-lang.org/u/xclaesse)\
**Post date:** [October 20, 2025, 2:40pm UTC](https://internals.rust-lang.org/t/stabilize-env-set-command-line/23633/5 "2025-10-20T14:40:59Z")

</div>

Do you know who can approve the stabilization if those 2 concerns are solved (maybe you?). The author wants to be sure he's not wasting his time before proceeding: [Stabilize `--env-set` option by GuillaumeGomez · Pull Request #119926 · rust-lang/rust · GitHub](https://github.com/rust-lang/rust/pull/119926#issuecomment-3421121817).

---

<div class="post-metadata">

**Author:** ![kpreid](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/kpreid/32/8484_2.png) [@kpreid](https://internals.rust-lang.org/u/kpreid)\
**Post date:** [October 20, 2025, 3:18pm UTC](https://internals.rust-lang.org/t/stabilize-env-set-command-line/23633/6 "2025-10-20T15:18:55Z")

</div>

I am not a member of T-compiler or any Rust Project team and cannot merge any PRs. I am only providing suggestions for what you can do based on general principles.

You wrote in the PR thread:

> - [Should --env-set affect other usages of environment](https://github.com/rust-lang/rust/pull/119926#issuecomment-1900703005). IMHO, no, and it's already well documented that only those 3 functions are affected:

I think this is not really true. The documentation says what it _does_ affect, but

- does not say what it _does not_ affect,
- nor does it actually contain the word “only” about the 3 things it lists.

If a PR which adds that clarification to the documentation were merged, presumably that would resolve the concern.

---

<div class="post-metadata">

**Author:** ![xclaesse](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/xclaesse/32/13711_2.png) [@xclaesse](https://internals.rust-lang.org/u/xclaesse)\
**Post date:** [October 20, 2025, 7:54pm UTC](https://internals.rust-lang.org/t/stabilize-env-set-command-line/23633/7 "2025-10-20T19:54:47Z")

</div>

Fair enough, thanks!

---

<div class="post-metadata">

**Author:** ![chrisd](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/chrisd/32/7232_2.png) [@chrisd](https://internals.rust-lang.org/u/chrisd)\
**Post date:** [October 22, 2025, 7:38am UTC](https://internals.rust-lang.org/t/stabilize-env-set-command-line/23633/8 "2025-10-22T07:38:54Z")

</div>

Just for future reference, commenting on an old closed PR is likely to be overlooked by most people, except perhaps the PR author (who likely doesn't have permission to approve stabilisation themselves). It's usually better to comment on the tracking issue if you want relevant teams to see it.

---

<div class="post-metadata">

**Author:** ![xclaesse](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/xclaesse/32/13711_2.png) [@xclaesse](https://internals.rust-lang.org/u/xclaesse)\
**Post date:** [October 22, 2025, 8:43am UTC](https://internals.rust-lang.org/t/stabilize-env-set-command-line/23633/9 "2025-10-22T08:43:24Z")

</div>

That's exactly why I opened this discussion here. I wanted to open a github issue but it redirected here for feature discussions. If there is a better place to bring visibility, please let me know 🙂
