diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2023-11-23 20:10:44 -0500 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2023-11-23 20:10:44 -0500 |
| commit | ee9223ff973bc3006da81611fb1cd36850d2fab8 (patch) | |
| tree | 105120a54a0b41ab34e7350f4843186d7dc0e7cd /compiler/rustc_interface/src | |
| parent | a4a5c976fee30bdd350aa0df10b14cb87ade48fe (diff) | |
| download | rust-ee9223ff973bc3006da81611fb1cd36850d2fab8.tar.gz rust-ee9223ff973bc3006da81611fb1cd36850d2fab8.zip | |
Enforce NonZeroUsize on thread count
This allows avoiding some if != 0 checks when allocating worker-local datasets.
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/util.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs index 8df3648a065..b3ab01a740a 100644 --- a/compiler/rustc_interface/src/util.rs +++ b/compiler/rustc_interface/src/util.rs @@ -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, || { |
