Workaround for this will require either wrapping jobserver::Client with std::mem::ManuallyDrop, or switching to my fork jobslot which supports calling Client::from_env unlimited number of times.
This PR thus port the change to upstream so that any crate using jobserver can benefit from this and can stop worrying about UB caused by calling Clieng::from_env multiple times in different crates.
So that it can be used in different crates without causing UB.
Motivation
opencv-rust
usesjobserver::Client::from_env
in itsbuild.rs
to parallelize generation of bindings, then callcc::Build::compile
with featurescc/parallel
enabled it will also calljobserver::Client::from_env
and creates a UB https://github.com/rust-lang/cc-rs/issues/844#issuecomment-1663960861Workaround for this will require either wrapping
jobserver::Client
withstd::mem::ManuallyDrop
, or switching to my forkjobslot
which supports callingClient::from_env
unlimited number of times.This PR thus port the change to upstream so that any crate using
jobserver
can benefit from this and can stop worrying about UB caused by callingClieng::from_env
multiple times in different crates.