Enforce NonZeroUsize on thread count
This allows avoiding some if != 0 checks when allocating worker-local datasets.
This commit is contained in:
parent
a4a5c976fe
commit
ee9223ff97
2 changed files with 8 additions and 5 deletions
|
@ -107,7 +107,7 @@ pub(crate) fn run_in_thread_pool_with_globals<F: FnOnce() -> R + Send, R: Send>(
|
|||
use rustc_query_impl::QueryCtxt;
|
||||
use rustc_query_system::query::{deadlock, QueryContext};
|
||||
|
||||
let registry = sync::Registry::new(threads);
|
||||
let registry = sync::Registry::new(std::num::NonZeroUsize::new(threads).unwrap());
|
||||
|
||||
if !sync::is_dyn_thread_safe() {
|
||||
return run_in_thread_with_globals(edition, || {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue