From 746a58d4359786e4aebb372a30829706fa5a968f Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 29 Jan 2024 23:59:09 +0100 Subject: Use generic `NonZero` internally. --- compiler/rustc_query_impl/src/lib.rs | 1 + compiler/rustc_query_impl/src/plumbing.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_query_impl/src') diff --git a/compiler/rustc_query_impl/src/lib.rs b/compiler/rustc_query_impl/src/lib.rs index 0fe5b9c664a..33116737a42 100644 --- a/compiler/rustc_query_impl/src/lib.rs +++ b/compiler/rustc_query_impl/src/lib.rs @@ -3,6 +3,7 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(rustdoc_internals)] +#![feature(generic_nonzero)] #![feature(min_specialization)] #![feature(rustc_attrs)] #![allow(rustc::potential_query_instability, unused_parens)] diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index a827717d9bb..8cbcce986a1 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -30,7 +30,7 @@ use rustc_serialize::Decodable; use rustc_serialize::Encodable; use rustc_session::Limit; use rustc_span::def_id::LOCAL_CRATE; -use std::num::NonZeroU64; +use std::num::NonZero; use thin_vec::ThinVec; #[derive(Copy, Clone)] @@ -68,7 +68,7 @@ impl QueryContext for QueryCtxt<'_> { #[inline] fn next_job_id(self) -> QueryJobId { QueryJobId( - NonZeroU64::new( + NonZero::::new( self.query_system.jobs.fetch_add(1, std::sync::atomic::Ordering::Relaxed), ) .unwrap(), -- cgit 1.4.1-3-g733a5