Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

raoulstrackx
Copy link
Contributor

PR 125046 prevents mutable references to statics with #[linkage]. Such a construct was used with the tests for the x86_64-fortanix-unknown-sgx target. This PR fixes this and cleans up code a bit in 5 steps. Each step passes CI:

  • The mut static is removed, and Task explicitly implements Send
  • Renaming of the task_queue::lock function
  • Pass function for Thread as Send to Thread::imp and update when Packet<'scope, T> implements Sync
  • Storing Task::p as a type that implements Send
  • Letting the compiler auto implement Send for Task

cc: @jethrogb

@rustbot
Copy link
Collaborator

rustbot commented May 31, 2024

r? @cuviper

rustbot has assigned @cuviper.
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 rustbot added O-SGX Target: SGX S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 31, 2024
@rust-log-analyzer

This comment has been minimized.

@raoulstrackx raoulstrackx force-pushed the raoul/rte-99-fix_mut_static_task_queue branch from 1ae82d7 to 70f8310 Compare May 31, 2024 08:09
@bjorn3
Copy link
Member

bjorn3 commented Jun 2, 2024

I think in #125046 I should have only denied #[linkage] static mut for extern statics. Basically moving the code I added in compiler/rustc_codegen_ssa/src/codegen_attrs.rs into the if tcx.is_foreign_item(did) arm.

@raoulstrackx
Copy link
Contributor Author

I think in #125046 I should have only denied #[linkage] static mut for extern statics. Basically moving the code I added in compiler/rustc_codegen_ssa/src/codegen_attrs.rs into the if tcx.is_foreign_item(did) arm.

Right, but even then I don't see why Task::p wouldn't need to implement Send as it's still passed from one thread (added to the list in Thread::new) to another (removed from the list in Thread::entry).

Anyway, I believe this PR still cleans up the code.

@workingjubilee
Copy link
Member

Yeah, seems preferable this way.
@bors r+

@bors
Copy link
Collaborator

bors commented Jun 3, 2024

📌 Commit 70f8310 has been approved by workingjubilee

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 Jun 3, 2024
@raoulstrackx raoulstrackx force-pushed the raoul/rte-99-fix_mut_static_task_queue branch from 70f8310 to 8db363c Compare June 4, 2024 06:46
@workingjubilee
Copy link
Member

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 4, 2024
@workingjubilee
Copy link
Member

Waiting for @jethrogb's approval.

@workingjubilee
Copy link
Member

hm in fact
@bors delegate=jethrogb

@bors
Copy link
Collaborator

bors commented Jun 4, 2024

✌️ @jethrogb, you can now approve this pull request!

If @workingjubilee told you to "r=me" after making some further change, please make that change, then do @bors r=@workingjubilee

@jethrogb
Copy link
Contributor

jethrogb commented Jun 4, 2024

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 4, 2024

📌 Commit 8db363c has been approved by jethrogb

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 4, 2024
@bors bors merged commit fcc0b64 into rust-lang:master Jun 5, 2024
@rustbot rustbot added this to the 1.80.0 milestone Jun 5, 2024
@fmease
Copy link
Member

fmease commented Jun 6, 2024

bors sleepy @bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 6, 2024
@jethrogb
Copy link
Contributor

jethrogb commented Jun 6, 2024

@fmease I'm confused about what you're trying to do. This PR is merged into master.

@fmease
Copy link
Member

fmease commented Jun 6, 2024

Just maintenance. Sometimes @bors's queue gets out of sync with GitHub (e.g., containing already merged PRs). While I could press the "synchronize" button, it's a bit destructive and buggy (try-builds get upgraded to builds, failing PRs suddenly show up in the queue, etc.). Therefore it's typical for someone to swoop in and manually "sync" the queue by r-'ing already merged PRs which still show up in the queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-SGX Target: SGX S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants