{"push_id":681549497,"size":1,"distinct_size":1,"ref":"refs/heads/disable-os-tls","head":"92c3b9c173ed6ee30e6d12ee996a88d733e82f26","before":"1b5f9cb1f1529e03cd9a1d60a40d17624baffa65","commits":[{"sha":"92c3b9c173ed6ee30e6d12ee996a88d733e82f26","author":{"email":"60c6d277a8bd81de7fdde19201bf9c58a3df08f4@alexcrichton.com","name":"Alex Crichton"},"message":"std: Fix unsoundness of std::thread::ScopedKey\n\nCurrently the compiler has no knowledge of `#[thread_local]` which forces users\nto take on two burdens of unsafety:\n\n* The lifetime of the borrow of a `#[thread_local]` static is **not** `'static`\n* Types in `static`s are required to be `Sync`\n\nThe thread-local modules mostly curb these facets of unsafety by only allowing\nvery limited scopes of borrows as well as allowing all types to be stored in a\nthread-local key (regardless of whether they are `Sync`) through an `unsafe\nimpl`.\n\nUnfortunately these measures have the consequence of being able to take the\naddress of the key itself and send it to another thread, allowing the same key\nto be accessed from two different threads. This is clearly unsafe, and this\ncommit fixes this problem with the same trick used by `LocalKey`, which is to\nhave an indirect function call to find the address of the *current thread's*\nthread local. This way the address of thread local keys can safely be sent among\nthreads as their lifetime truly is `'static`.\n\nThis commit will reduce the performance of cross-crate scoped thread locals as\nit now requires an indirect function call, but this can likely be overcome in a\nfuture commit.\n\nCloses #25894","distinct":true,"url":"https://api.github.com/repos/alexcrichton/rust/commits/92c3b9c173ed6ee30e6d12ee996a88d733e82f26"}]}