-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify that RUST_MIN_STACK may be internally cached #109225
Conversation
For larger applications it's important that users set `RUST_MIN_STACK` at the start of their program because `min_stack` caches the value. Not doing so can lead to their `env::set_var` call surprisingly not having any effect.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @m-ou-se (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
It's not clear that we should not be not-caching it instead. |
With environment variables like these we don't make any promises since the intent is for users (or other, external, tools) to set them. They aren't intended as an internal API. It's possible that in the future Making strong promises here would be a libs-api decision. But personally I think that if we want to support a global override then we should have a proper API for that rather than messing with the environment. |
I think it's reasonable to expose |
Can we note it down in a more "the check on this environment variable shouldn't be relied on to happen at a particular moment, and that's partly because currently we cache it as an optimization" way, then, so this doesn't get construed as a promise? |
I am still super nervous about mentioning implementation details that shouldn't be relied upon. We tend to avoid that. We could document that setting |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
Okay, I've changed it to:
|
That seems reasonable to me. @bors r+ |
Clarify that RUST_MIN_STACK may be internally cached For larger applications it's important that users set `RUST_MIN_STACK` at the start of their program because [`min_stack`](https://github.com/rust-lang/rust/blob/7d3e03666a93bd2b0f78b3933f9305832af771a5/library/std/src/sys_common/thread.rs) caches the value. Not doing so can lead to their `env::set_var` call surprisingly not having any effect. In my own testing `RUST_MIN_STACK` had no effect until I moved it to the top of `main()`. Hopefully this clarification in the docs will help others going forward.
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#109225 (Clarify that RUST_MIN_STACK may be internally cached) - rust-lang#109800 (Improve safe transmute error reporting) - rust-lang#110158 (Remove obsolete test case) - rust-lang#110180 (don't uniquify regions when canonicalizing) - rust-lang#110207 (Assemble `Unpin` candidates specially for generators in new solver) - rust-lang#110276 (Remove all but one of the spans in `BoundRegionKind::BrAnon`) - rust-lang#110279 (rustdoc: Correctly handle built-in compiler proc-macros as proc-macro and not macro) - rust-lang#110298 (Cover edge cases for {f32, f64}.hypot() docs) - rust-lang#110299 (Switch to `EarlyBinder` for `impl_subject` query) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
For larger applications it's important that users set
RUST_MIN_STACK
at the start of their program becausemin_stack
caches the value. Not doing so can lead to theirenv::set_var
call surprisingly not having any effect.In my own testing
RUST_MIN_STACK
had no effect until I moved it to the top ofmain()
. Hopefully this clarification in the docs will help others going forward.