-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Move __thread_local_inner to sys #108927
Move __thread_local_inner to sys #108927
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
Perhaps it would make sense to split the macro up and use I'm not sure if |
Well, the problem with splitting the macro is that currently, the macro has to be public. As far as I understand, any macro called by the public macro should also be public, which means exporting many macros that are internal implementation details. That's why I initially thought about using functions, but well, it is not possible to have generic statics, so I ended up just moving the whole thing to sys. Also, I think sys_common is supposed not to have any platform-dependent code, so it probably isn't the correct place. Maybe @devsnek can provide better ideas? |
I meant something like this, where the right |
I see, I will try to do it this way. It would definitely make the code more readable. |
Can we push this into |
Move __thread_local_inner macro in crate::thread::local to crate::sys. Currently, the tidy check does not fail for `library/std/src/thread/local.rs` even though it contains platform specific code. This is beacause target_family did not exist at the time the tidy checks were written [1]. [1]: rust-lang#105861 (comment) Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
Split the __thread_local_inner macro to make it more readable. Also move everything to crate::sys::common::thread_local. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
aadefd1
to
5828910
Compare
This allows removing all the platform-dependent code from `library/std/src/thread/local.rs` and `library/std/src/thread/mod.rs` Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
Excellent, thank you! Let's see what the full CI run says about it. |
@bors r- |
Sorry, another review inspired me to take a closer look at some things and I just verified they are actually correct. More confident this will pass in a rollup now. @bors r+ rollup |
…bilee Move __thread_local_inner to sys Move `__thread_local_inner` macro in `crate::thread::local` to `crate::sys`. Initially, I was thinking about removing this macro completely, but I could not find a way to create the generic statics without macros, so in the end, I just moved to code around. This probably will need a rebase once rust-lang#108917 is merged r? `@workingjubilee`
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#106276 (Fix `vec_deque::Drain` FIXME) - rust-lang#107629 (rustdoc: sort deprecated items lower in search) - rust-lang#108711 (Add note when matching token with nonterminal) - rust-lang#108757 (rustdoc: Migrate `document_item_info` to Askama) - rust-lang#108784 (rustdoc: Migrate sidebar rendering to Askama) - rust-lang#108927 (Move __thread_local_inner to sys) - rust-lang#108949 (Honor current target when checking conditional compilation values) - rust-lang#108950 (Directly construct Inherited in typeck.) - rust-lang#108988 (rustdoc: Don't crash on `crate` references in blocks) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Move
__thread_local_inner
macro incrate::thread::local
tocrate::sys
. Initially, I was thinking about removing this macro completely, but I could not find a way to create the generic statics without macros, so in the end, I just moved to code around.This probably will need a rebase once #108917 is merged
r? @workingjubilee