mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Use generic NonZero
everywhere else.
This commit is contained in:
parent
36d194f561
commit
0c474acdfa
@ -136,7 +136,7 @@ thread_local! {
|
||||
arena: arena::Arena::new(),
|
||||
names: fxhash::FxHashMap::default(),
|
||||
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(),
|
||||
});
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//! Helper module which helps to determine amount of threads to be used
|
||||
//! during tests execution.
|
||||
use std::{env, num::NonZeroUsize, thread};
|
||||
use std::{env, num::NonZero, thread};
|
||||
|
||||
pub fn get_concurrency() -> usize {
|
||||
if let Ok(value) = env::var("RUST_TEST_THREADS") {
|
||||
match value.parse::<NonZeroUsize>().ok() {
|
||||
match value.parse::<NonZero<usize>>().ok() {
|
||||
Some(n) => n.get(),
|
||||
_ => panic!("RUST_TEST_THREADS is `{value}`, should be a positive integer."),
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#![unstable(feature = "test", issue = "50297")]
|
||||
#![doc(test(attr(deny(warnings))))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(generic_nonzero)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(internal_output_capture)]
|
||||
#![feature(staged_api)]
|
||||
|
Loading…
Reference in New Issue
Block a user