-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add comments explaining the unix command-line argument support. #87279
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Following up on rust-lang#87236, add comments to the unix command-line argument support explaining that the code doesn't mutate the system-provided argc/argv, and that this is why the code doesn't need a lock or special memory ordering.
Responding to the comment in #87236, release/acquire feels like it would obscure the intent here. This code is just deferring parsing for the system argc/argv, which is why relaxed is sufficient, but it's also the reason we don't need a mutex. If someone ever adds Rust code to mutate the argv array, they may need more than just release/acquire on argc/argv; they may need to reintroduce the mutex too. And they may need to think about potential interactions with C code which may also be able to observe the system-provided argv array (eg. if it's also registered in a .init_array function). |
Thanks! @bors r+ rollup
I'd say |
📌 Commit 2a56a68 has been approved by |
…alfJung Add comments explaining the unix command-line argument support. Following up on rust-lang#87236, add comments to the unix command-line argument support explaining that the code doesn't mutate the system-provided argc/argv, and that this is why the code doesn't need a lock or special memory ordering. r? `@RalfJung`
…alfJung Add comments explaining the unix command-line argument support. Following up on rust-lang#87236, add comments to the unix command-line argument support explaining that the code doesn't mutate the system-provided argc/argv, and that this is why the code doesn't need a lock or special memory ordering. r? ``@RalfJung``
…laumeGomez Rollup of 9 pull requests Successful merges: - rust-lang#87187 (Fix NixOS detection) - rust-lang#87206 (avoid temporary vectors/reuse iterators) - rust-lang#87230 (Fix docblock <table> overflow) - rust-lang#87273 (Recognize bounds on impls as const bounds) - rust-lang#87279 (Add comments explaining the unix command-line argument support.) - rust-lang#87301 (Fix typo in compile.rs) - rust-lang#87311 (Get back the more precise suggestion spans of old regionck) - rust-lang#87321 (Add long explanation for E0722) - rust-lang#87342 (Add long explanation for E0757) Failed merges: - rust-lang#87270 (Don't display <table> in item summary) r? `@ghost` `@rustbot` modify labels: rollup
Following up on #87236, add comments to the unix command-line argument
support explaining that the code doesn't mutate the system-provided
argc/argv, and that this is why the code doesn't need a lock or special
memory ordering.
r? @RalfJung