-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Eliminate confusing "globals" terminology. #74079
Conversation
Instead of "globals" we could also use "implicit state" or just "state". The concept of "global state" makes sense IMO even if it's scoped to a thread, but we can be more precise than that if it's less confusing overall. cc @rust-lang/compiler |
95e2984
to
6d1eb5d
Compare
Whether this renaming is worth doing probably depends on the amount of time passing before some "proper design" is implemented. (Year? Perhaps. Month? Hardly.) I'd prefer to decide which exactly "session" this data is local to and put it into that session's structure, i.e. come up with the "proper design" part sooner rather than later and avoid intermediate renamings. EDIT: Zulip thread - https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Thread-local.20.60GLOBALS.60 |
I'm surprised by this response. The change is simple, just a renaming. It's not that invasive? If nothing else, I definitely want the comments to be added to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a nit, but the renaming seems clearer to me (although I don't personally have any particular association with "global" meaning "to the process", I think I always find it kind of ambiguous just what it's "global" to). I don't know that we need to wait until the one true architecture is found to make small renamings, particularly if there isn't really an active effort towards creating that architecture..? (But maybe there is.)
@bors rollup=always |
6d1eb5d
to
fdd9840
Compare
@bors r=nikomatsakis |
📌 Commit fdd9840c76dbf5e24494576b0c012cc20866a47c has been approved by |
There are some structures that are called "globals", but are they global to a compilation session, and not truly global. I have always found this highly confusing, so this commit renames them as "session globals" and adds a comment explaining things. Also, the commit fixes an unnecessary nesting of `set()` calls `src/librustc_errors/json/tests.rs`
fdd9840
to
81c5bb6
Compare
@bors r=nikomatsakis |
📌 Commit 81c5bb6 has been approved by |
…arth Rollup of 14 pull requests Successful merges: - rust-lang#73292 (Fixing broken link for the Eq trait) - rust-lang#73791 (Allow for parentheses after macro intra-doc-links) - rust-lang#74070 ( Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>.) - rust-lang#74077 (Use relative path for local links to primitives) - rust-lang#74079 (Eliminate confusing "globals" terminology.) - rust-lang#74107 (Hide `&mut self` methods from Deref in sidebar if there are no `DerefMut` impl for the type.) - rust-lang#74136 (Fix broken link in rustdocdoc) - rust-lang#74137 (Update cargo) - rust-lang#74142 (Liballoc use vec instead of vector) - rust-lang#74143 (Try remove unneeded ToString import in liballoc slice) - rust-lang#74146 (update miri) - rust-lang#74150 (Avoid "blacklist") - rust-lang#74184 (Add docs for intra-doc-links) - rust-lang#74188 (Tweak `::` -> `:` typo heuristic and reduce verbosity) Failed merges: - rust-lang#74122 (Start-up clean-up) - rust-lang#74127 (Avoid "whitelist") r? @ghost
There are some structures that are called "globals", but are they global
to a compilation session, and not truly global. I have always found this
highly confusing, so this commit renames them as "session globals" and
adds a comment explaining things.
Also, the commit fixes an unnecessary nesting of
set()
callssrc/librustc_errors/json/tests.rs
r? @Aaron1011