Skip to content
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

Avoid function-scoping global variables #75958

Merged
merged 1 commit into from
Aug 27, 2020

Conversation

Mark-Simulacrum
Copy link
Member

In 2e6f2e8, we added a main function to the publish_toolstate.py script.
Unfortunately, we missed that the Python program implicitly declares global
variables in that code, which means that adding a function changes variable
scoping and breaks other code.

This commit avoids introducing that function and adds a warning to future
editors of the code.

In 2e6f2e8, we added a main function to the publish_toolstate.py script.
Unfortunately, we missed that the Python program implicitly declares global
variables in that code, which means that adding a function changes variable
scoping and breaks other code.

This commit avoids introducing that function and adds a warning to future
editors of the code.
@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 26, 2020
Copy link
Member

@kennytm kennytm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the global github_token inside issue() is an oversight (others are passed as arguments). but we haven't statically checked which other variables are still accessed globally. so we gotta workaround like this for now :(

@kennytm
Copy link
Member

kennytm commented Aug 26, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Aug 26, 2020

📌 Commit c8b2402 has been approved by kennytm

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 26, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 27, 2020
Rollup of 10 pull requests

Successful merges:

 - rust-lang#74730 (Hexagon libstd: update type defs)
 - rust-lang#75758 (Fixes for VxWorks)
 - rust-lang#75780 (Unconfuse Unpin docs a bit)
 - rust-lang#75806 (Prevent automatic page change when using history)
 - rust-lang#75818 (Update docs for SystemTime Windows implementation)
 - rust-lang#75837 (Fix font color for help button in ayu and dark themes)
 - rust-lang#75870 (Unify theme choices border color in ayu theme)
 - rust-lang#75875 (Shorten liballoc vec resize intra-doc link)
 - rust-lang#75953 (Fix swapped stability attributes for rustdoc lints)
 - rust-lang#75958 (Avoid function-scoping global variables)

Failed merges:

r? @ghost
@bors bors merged commit 8fd73aa into rust-lang:master Aug 27, 2020
@cuviper cuviper added this to the 1.48.0 milestone Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants