-
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
Rollup of 6 pull requests #127924
Rollup of 6 pull requests #127924
Commits on Jul 15, 2024
-
Configuration menu - View commit details
-
Copy full SHA for eb3cc5f - Browse repository at this point
Copy the full SHA eb3cc5fView commit details
Commits on Jul 18, 2024
-
Update extern linking documentation
In particular, remove the note saying cdylibs can't link against dylibs — that hasn't been true for over four years. * 2019-11-07: note is written: rust-lang@b54e8ec * 2020-01-23: restriction is lifted (without updating docs): rust-lang@72aaa3a
Configuration menu - View commit details
-
Copy full SHA for d3303b0 - Browse repository at this point
Copy the full SHA d3303b0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2507301 - Browse repository at this point
Copy the full SHA 2507301View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0871175 - Browse repository at this point
Copy the full SHA 0871175View commit details -
Allow a git command for getting the current branch in bootstrap to fail
It can fail when in git is in detached HEAD mode.
Configuration menu - View commit details
-
Copy full SHA for 4dc8e66 - Browse repository at this point
Copy the full SHA 4dc8e66View commit details -
Update
ReentrantLock
implementation, addCURRENT_ID
thread local.This changes `ReentrantLock` to use `ThreadId` for the thread ownership check instead of the address of a thread local. Unlike TLS blocks, `ThreadId` is guaranteed to be unique across the lifetime of the process, so if any thread ever terminates while holding a `ReentrantLockGuard`, no other thread may ever acquire that lock again. On platforms with 64-bit atomics, this is a very simple change. On other platforms, the approach used is slightly more involved, as explained in the module comment. This also adds a `CURRENT_ID` thread local in addition to the already existing `CURRENT`. This allows us to access the current `ThreadId` without the relatively heavy machinery used by `thread::current().id()`.
Configuration menu - View commit details
-
Copy full SHA for fe89962 - Browse repository at this point
Copy the full SHA fe89962View commit details -
Rollup merge of rust-lang#124881 - Sp00ph:reentrant_lock_tid, r=joboet
Use ThreadId instead of TLS-address in `ReentrantLock` Fixes rust-lang#123458 `ReentrantLock` currently uses the address of a thread local variable as an ID that's unique across all currently running threads. This can lead to uninituitive behavior as in rust-lang#123458 if TLS blocks get reused. This PR changes `ReentrantLock` to instead use the `ThreadId` provided by `std` as the unique ID. `ThreadId` guarantees uniqueness across the lifetime of the whole process, so we don't need to worry about reusing IDs of terminated threads. The main appeal of this PR is thus the possibility of changing the `ReentrantLock` API to guarantee that if a thread leaks a lock guard, no other thread may ever acquire that lock again. This does entail some complications: - previously, the only way to retrieve the current thread ID would've been using `thread::current().id()` which creates a temporary `Arc` and which isn't available in TLS destructors. As part of this PR, the thread ID instead gets cached in its own thread local, as suggested [here](rust-lang#123458 (comment)). - `ThreadId` is always 64-bit whereas the current implementation uses a usize-sized ID. Since this ID needs to be updated atomically, we can't simply use a single atomic variable on 32 bit platforms. Instead, we fall back to using a (sound) seqlock on 32-bit platforms, which works because only one thread at a time can write to the ID. This seqlock is technically susceptible to the ABA problem, but the attack vector to create actual unsoundness has to be very specific: - You would need to be able to lock+unlock the lock exactly 2^31 times (or a multiple thereof) while a thread trying to lock it sleeps - The sleeping thread would have to suspend after reading one half of the thread id but before reading the other half - The teared result from combining the halves of the thread ID would have to exactly line up with the sleeping thread's ID The risk of this occurring seems slim enough to be acceptable to me, but correct me if I'm wrong. This also means that the size of the lock increases by 8 bytes on 32-bit platforms, but this also shouldn't be an issue. Performance wise, I did some crude testing of the only case where this could lead to real slowdowns, which is the case of locking a `ReentrantLock` that's already locked by the current thread. On both aarch64 and x86-64, there is (expectedly) pretty much no performance hit. I didn't have any 32-bit platforms to test the seqlock performance on, so I did the next best thing and just forced the 64-bit platforms to use the seqlock implementation. There, the performance degraded by ~1-2ns/(lock+unlock) on x86-64 and ~6-8ns/(lock+unlock) on aarch64, which is measurable but seems acceptable to me seeing as 32-bit platforms should be a small minority anyways. cc `@joboet` `@RalfJung` `@CAD97`
Configuration menu - View commit details
-
Copy full SHA for f62aa41 - Browse repository at this point
Copy the full SHA f62aa41View commit details -
Rollup merge of rust-lang#127656 - RalfJung:pub_use_of_private_extern…
…_crate, r=petrochenkov make pub_use_of_private_extern_crate show up in cargo's future breakage reports This has been a lint for many years. However, turns out that outright removing it right now would lead to [tons of crater regressions](rust-lang#127656 (comment)) due to crates depending on an ancient version of `bitflags`. So for now this PR just makes this future-compat lint show up in cargo's reports, so people are warned when they use a dependency that is affected by this. r? `@petrochenkov`
Configuration menu - View commit details
-
Copy full SHA for ec6110f - Browse repository at this point
Copy the full SHA ec6110fView commit details -
Rollup merge of rust-lang#127748 - scottmcm:option_len, r=joboet
Use Option's discriminant as its size hint I was looking at this in MIR after a question on discord, and noticed that it ends up with a switch in MIR (<https://rust.godbolt.org/z/3q4cYnnb3>), which it doesn't need because (as `Option::as_slice` uses) the discriminant is already the length.
Configuration menu - View commit details
-
Copy full SHA for 6f7fa03 - Browse repository at this point
Copy the full SHA 6f7fa03View commit details -
Rollup merge of rust-lang#127854 - fmease:glob-import-type_ir_inheren…
…t-lint, r=compiler-errors Add internal lint for detecting non-glob imports of `rustc_type_ir::inherent` rust-lang#127627 (comment) r? compiler-errors
Configuration menu - View commit details
-
Copy full SHA for 4ad2c99 - Browse repository at this point
Copy the full SHA 4ad2c99View commit details -
Rollup merge of rust-lang#127908 - fasterthanlime:patch-1, r=jieyouxu
Update extern linking documentation In particular, remove the note saying cdylibs can't link against dylibs — that hasn't been true for over four years. * 2019-11-07: note is written: rust-lang@b54e8ec * 2020-01-23: restriction is lifted (without updating docs): rust-lang@72aaa3a
Configuration menu - View commit details
-
Copy full SHA for ac26f6a - Browse repository at this point
Copy the full SHA ac26f6aView commit details -
Rollup merge of rust-lang#127919 - Kobzol:fix-git-command, r=onur-ozkan
Allow a git command for getting the current branch in bootstrap to fail Found by `@lukas-code` [here](rust-lang#127680 (comment)). The bug was introduced in rust-lang#127680 (before, the command was allowed to fail). r? `@onur-ozkan`
Configuration menu - View commit details
-
Copy full SHA for 6c10822 - Browse repository at this point
Copy the full SHA 6c10822View commit details