-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
LocalIo is unsafe and should not be. #11053
Labels
A-runtime
Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
Comments
ghost
assigned alexcrichton
Dec 18, 2013
All of this is irrelevant with libgreen gone. |
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Jul 14, 2023
Use `cargo build --tests` in CI I noticed that we run a `cargo build` but end up downloading/building a bunch of deps after that for tests in CI https://github.com/rust-lang/rust-clippy/actions/runs/5426673277/jobs/9869019973#step:6:12 https://github.com/rust-lang/rust-clippy/actions/runs/5426673277/jobs/9869019973#step:7:11 This builds the tests in the build step too, it may speed up runs by downloading/building more in parallel changelog: none
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-runtime
Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
The current implementation of
LocalIo
involves unsafe borrowing which doesn't transfer ownership of theIoFactory
. This unsafe code allows for mutably aliasing theIoFactory
multiple times on the stack (leading to memory unsafety).Fixing this would involve dancing around transferring ownership of the
IoFactory
between the calls that it makes. My initial idea was forLocalIo
to take ownership and give out&mut
loans to it, but this is insufficient because when a green task context switches the scheduler must again have ownership of theIoFactory
.My best idea for doing this right now is to change all methods on
IoFactory
to take~self
and then right before the M:N methods block they would transfer ownership back to the scheduler. All the 1:1 methods would basically immediately return ownership of the factory back to the localTask
.The text was updated successfully, but these errors were encountered: