Skip to content
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

Remove dependency on the synchapi winapi feature #70

Merged
merged 1 commit into from
Apr 27, 2018

Conversation

alexcrichton
Copy link
Contributor

Pulling in parking_lot to the Rust compiler unfortunately had adverse side
effects on the binary dependencies of rustc -- rust-lang/rust#49438. It turns
out this is due to a number of bugs happening all at once, and currently we're
looking for ways to fix the beta/master branches of rustc to fix this for now
(not necessarily in the best way).

This commit removes the activation of the synchapi feature of winapi which
prevents libsynchronization.a from being linked in (and prevents rustc from
accidentally picking up a dependency on a missing DLL). The synchapi feature
was only activated for access to the Sleep function, but that function
actually resides in kernel32.dll. As a result this commit inlines the
definition of Sleep into this crate to avoid needing to depend on an upstream
definition.

@@ -17,11 +17,14 @@ use std::sync::atomic::spin_loop_hint;
#[cfg(windows)]
#[inline]
fn thread_yield() {
extern "system" {
fn Sleep(a: winapi::shared::minwindef::DWORD);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment explaining why this is being pulled in directly?

Pulling in `parking_lot` to the Rust compiler unfortunately had adverse side
effects on the binary dependencies of rustc -- rust-lang/rust#49438. It turns
out this is due to a number of bugs happening all at once, and currently we're
looking for ways to fix the beta/master branches of rustc to fix this for now
(not necessarily in the best way).

This commit removes the activation of the `synchapi` feature of `winapi` which
prevents `libsynchronization.a` from being linked in (and prevents rustc from
accidentally picking up a dependency on a missing DLL). The `synchapi` feature
was only activated for access to the `Sleep` function, but that function
actually resides in `kernel32.dll`. As a result this commit inlines the
definition of `Sleep` into this crate to avoid needing to depend on an upstream
definition.
@alexcrichton
Copy link
Contributor Author

Updated!

@retep998
Copy link

retep998 commented Apr 27, 2018

Might be worth mentioning in the comment that this change was only done for the sake of building Rust itself as in any other situation libsynchronization.a would not be coming from MinGW.

@Amanieu Amanieu merged commit 357488b into Amanieu:master Apr 27, 2018
@alexcrichton alexcrichton deleted the less-sync branch April 27, 2018 03:30
@alexcrichton
Copy link
Contributor Author

Thanks @Amanieu! Could you also publish a new version so we can update rustc?

@Amanieu
Copy link
Owner

Amanieu commented Apr 27, 2018

Done!

@alexcrichton
Copy link
Contributor Author

Awesome, thanks @Amanieu!

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Apr 27, 2018
This commit updates `parking_lot` to pull in Amanieu/parking_lot#70 and...

Closes rust-lang#49438
kennytm added a commit to kennytm/rust that referenced this pull request Apr 27, 2018
…Mark-Simulacrum

Update `parking_lot` dependencies

This commit updates `parking_lot` to pull in Amanieu/parking_lot#70 and...

Closes rust-lang#49438
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants