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

Don't allow unsafe statics outside of extern blocks (beta version) #127944

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Jul 18, 2024

This PR fixes a regression where we allowed unsafe static items in top-level modules (i.e. outside of unsafe extern blocks).

#127943 does not rebase cleanly, so I've prepared an extremely pared down version of this PR for beta purposes.

@rustbot
Copy link
Collaborator

rustbot commented Jul 18, 2024

r? @TaKO8Ki

rustbot has assigned @TaKO8Ki.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot
Copy link
Collaborator

rustbot commented Jul 18, 2024

⚠️ Warning ⚠️

  • Pull requests are usually filed against the master branch for this repo, but this one is against beta. Please double check that you specified the right target!

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 18, 2024
@compiler-errors compiler-errors added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jul 18, 2024
@compiler-errors compiler-errors assigned oli-obk and unassigned TaKO8Ki Jul 18, 2024
@compiler-errors
Copy link
Member Author

compiler-errors commented Jul 18, 2024

Please don't r+ unless release is ok w/ this. Apologies for the ad-hoc nature of this change, but the other PR doesn't rebase well at all.

Do please r+ the other version (#127943), though 😸 ❤️

@wesleywiser
Copy link
Member

I think we should definitely backport this, so consider this backport-approved from T-compiler's perspective.

@Mark-Simulacrum
Copy link
Member

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Jul 18, 2024

📌 Commit 42c2364 has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@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 Jul 18, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 19, 2024
…orino

Don't allow unsafe statics outside of extern blocks

This PR fixes a regression where we allowed `unsafe static` items in top-level modules (i.e. outside of `unsafe extern` blocks).

It's harder IMO to integrate this into the `check_item_safety` function, so I opted to just put this check on the `static` item itself.

Beta version of this lives at rust-lang#127944.

r? `@oli-obk` or `@spastorino`
@bors
Copy link
Contributor

bors commented Jul 19, 2024

⌛ Testing commit 42c2364 with merge b06e8ad...

tgross35 added a commit to tgross35/rust that referenced this pull request Jul 19, 2024
…orino

Don't allow unsafe statics outside of extern blocks

This PR fixes a regression where we allowed `unsafe static` items in top-level modules (i.e. outside of `unsafe extern` blocks).

It's harder IMO to integrate this into the `check_item_safety` function, so I opted to just put this check on the `static` item itself.

Beta version of this lives at rust-lang#127944.

r? ``@oli-obk`` or ``@spastorino``
@bors
Copy link
Contributor

bors commented Jul 19, 2024

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing b06e8ad to beta...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 19, 2024
@bors bors merged commit b06e8ad into rust-lang:beta Jul 19, 2024
7 checks passed
@rustbot rustbot added this to the 1.80.0 milestone Jul 19, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 19, 2024
…orino

Don't allow unsafe statics outside of extern blocks

This PR fixes a regression where we allowed `unsafe static` items in top-level modules (i.e. outside of `unsafe extern` blocks).

It's harder IMO to integrate this into the `check_item_safety` function, so I opted to just put this check on the `static` item itself.

Beta version of this lives at rust-lang#127944.

r? ```@oli-obk``` or ```@spastorino```
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jul 19, 2024
Rollup merge of rust-lang#127943 - compiler-errors:no-unsafe, r=spastorino

Don't allow unsafe statics outside of extern blocks

This PR fixes a regression where we allowed `unsafe static` items in top-level modules (i.e. outside of `unsafe extern` blocks).

It's harder IMO to integrate this into the `check_item_safety` function, so I opted to just put this check on the `static` item itself.

Beta version of this lives at rust-lang#127944.

r? ```@oli-obk``` or ```@spastorino```
@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants