Use generic NonZero
everywhere else.
This commit is contained in:
parent
36d194f561
commit
0c474acdfa
3 changed files with 4 additions and 3 deletions
|
@ -136,7 +136,7 @@ thread_local! {
|
||||||
arena: arena::Arena::new(),
|
arena: arena::Arena::new(),
|
||||||
names: fxhash::FxHashMap::default(),
|
names: fxhash::FxHashMap::default(),
|
||||||
strings: Vec::new(),
|
strings: Vec::new(),
|
||||||
// Start with a base of 1 to make sure that `NonZeroU32` works.
|
// Start with a base of 1 to make sure that `NonZero<u32>` works.
|
||||||
sym_base: NonZero::new(1).unwrap(),
|
sym_base: NonZero::new(1).unwrap(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
//! Helper module which helps to determine amount of threads to be used
|
//! Helper module which helps to determine amount of threads to be used
|
||||||
//! during tests execution.
|
//! during tests execution.
|
||||||
use std::{env, num::NonZeroUsize, thread};
|
use std::{env, num::NonZero, thread};
|
||||||
|
|
||||||
pub fn get_concurrency() -> usize {
|
pub fn get_concurrency() -> usize {
|
||||||
if let Ok(value) = env::var("RUST_TEST_THREADS") {
|
if let Ok(value) = env::var("RUST_TEST_THREADS") {
|
||||||
match value.parse::<NonZeroUsize>().ok() {
|
match value.parse::<NonZero<usize>>().ok() {
|
||||||
Some(n) => n.get(),
|
Some(n) => n.get(),
|
||||||
_ => panic!("RUST_TEST_THREADS is `{value}`, should be a positive integer."),
|
_ => panic!("RUST_TEST_THREADS is `{value}`, should be a positive integer."),
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#![unstable(feature = "test", issue = "50297")]
|
#![unstable(feature = "test", issue = "50297")]
|
||||||
#![doc(test(attr(deny(warnings))))]
|
#![doc(test(attr(deny(warnings))))]
|
||||||
#![doc(rust_logo)]
|
#![doc(rust_logo)]
|
||||||
|
#![feature(generic_nonzero)]
|
||||||
#![feature(rustdoc_internals)]
|
#![feature(rustdoc_internals)]
|
||||||
#![feature(internal_output_capture)]
|
#![feature(internal_output_capture)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue