diff --git a/benches/src/lib.rs b/benches/src/lib.rs index 699ab13e86461..a9fb21a8106d2 100644 --- a/benches/src/lib.rs +++ b/benches/src/lib.rs @@ -39,6 +39,6 @@ #[macro_export] macro_rules! bench { ($name:literal) => { - concat!(module_path!(), "::", $name) + ::core::concat!(::core::module_path!(), "::", $name) }; } diff --git a/crates/bevy_animation/src/animation_curves.rs b/crates/bevy_animation/src/animation_curves.rs index b08310d459fa5..4fc6a57f3df8d 100644 --- a/crates/bevy_animation/src/animation_curves.rs +++ b/crates/bevy_animation/src/animation_curves.rs @@ -773,7 +773,7 @@ where /// This can be used in the following way: /// /// ``` -/// # use bevy_animation::{animation_curves::AnimatedField, animated_field}; +/// # use bevy_animation::animated_field; /// # use bevy_color::Srgba; /// # use bevy_ecs::component::Component; /// # use bevy_math::Vec3; @@ -793,9 +793,10 @@ where #[macro_export] macro_rules! animated_field { ($component:ident::$field:tt) => { - AnimatedField::new_unchecked(stringify!($field), |component: &mut $component| { - &mut component.$field - }) + $crate::animation_curves::AnimatedField::new_unchecked( + ::core::stringify!($field), + |component: &mut $component| &mut component.$field, + ) }; } diff --git a/crates/bevy_animation/src/lib.rs b/crates/bevy_animation/src/lib.rs index ac78cf01f1183..b63ef7998dc62 100644 --- a/crates/bevy_animation/src/lib.rs +++ b/crates/bevy_animation/src/lib.rs @@ -1571,7 +1571,7 @@ impl<'a> Iterator for TriggeredEventsIter<'a> { mod tests { use crate::{ self as bevy_animation, - prelude::{AnimatableCurve, AnimatableKeyframeCurve, AnimatedField}, + prelude::{AnimatableCurve, AnimatableKeyframeCurve}, }; use bevy_math::Vec3; use bevy_reflect::map::{DynamicMap, Map}; diff --git a/crates/bevy_app/src/plugin_group.rs b/crates/bevy_app/src/plugin_group.rs index 002b00799d443..3d22ed75e69fe 100644 --- a/crates/bevy_app/src/plugin_group.rs +++ b/crates/bevy_app/src/plugin_group.rs @@ -135,12 +135,12 @@ macro_rules! plugin_group { } => { $(#[$group_meta])* /// - $(#[doc = concat!( - " - [`", stringify!($plugin_name), "`](" $(, stringify!($plugin_path), "::")*, stringify!($plugin_name), ")" + $(#[doc = ::core::concat!( + " - [`", ::core::stringify!($plugin_name), "`](" $(, ::core::stringify!($plugin_path), "::")*, ::core::stringify!($plugin_name), ")" $(, " - with feature `", $plugin_feature, "`")? )])* - $($(#[doc = concat!( - " - [`", stringify!($plugin_group_name), "`](" $(, stringify!($plugin_group_path), "::")*, stringify!($plugin_group_name), ")" + $($(#[doc = ::core::concat!( + " - [`", ::core::stringify!($plugin_group_name), "`](" $(, ::core::stringify!($plugin_group_path), "::")*, ::core::stringify!($plugin_group_name), ")" $(, " - with feature `", $plugin_group_feature, "`")? )])+)? $( @@ -158,7 +158,7 @@ macro_rules! plugin_group { $(#[$plugin_meta])* { const _: () = { - const fn check_default() {} + const fn check_default() {} check_default::<$($plugin_path::)*$plugin_name>(); }; @@ -170,7 +170,7 @@ macro_rules! plugin_group { $(#[$plugin_group_meta])* { const _: () = { - const fn check_default() {} + const fn check_default() {} check_default::<$($plugin_group_path::)*$plugin_group_name>(); }; @@ -182,7 +182,7 @@ macro_rules! plugin_group { $(#[$hidden_plugin_meta])* { const _: () = { - const fn check_default() {} + const fn check_default() {} check_default::<$($hidden_plugin_path::)*$hidden_plugin_name>(); }; diff --git a/crates/bevy_asset/src/handle.rs b/crates/bevy_asset/src/handle.rs index b133d79bca96c..fc7e735fa4d35 100644 --- a/crates/bevy_asset/src/handle.rs +++ b/crates/bevy_asset/src/handle.rs @@ -705,7 +705,7 @@ impl TryFrom for Handle { #[macro_export] macro_rules! uuid_handle { ($uuid:expr) => {{ - $crate::Handle::Uuid($crate::uuid::uuid!($uuid), core::marker::PhantomData) + $crate::Handle::Uuid($crate::uuid::uuid!($uuid), ::core::marker::PhantomData) }}; } diff --git a/crates/bevy_asset/src/io/embedded/mod.rs b/crates/bevy_asset/src/io/embedded/mod.rs index 3d830b364d53d..da412a944ef67 100644 --- a/crates/bevy_asset/src/io/embedded/mod.rs +++ b/crates/bevy_asset/src/io/embedded/mod.rs @@ -223,11 +223,11 @@ macro_rules! embedded_path { }}; ($source_path: expr, $path_str: expr) => {{ - let crate_name = module_path!().split(':').next().unwrap(); + let crate_name = ::core::module_path!().split(':').next().unwrap(); $crate::io::embedded::_embedded_asset_path( crate_name, $source_path.as_ref(), - file!().as_ref(), + ::core::file!().as_ref(), $path_str.as_ref(), ) }}; @@ -351,8 +351,8 @@ macro_rules! embedded_asset { .world_mut() .resource_mut::<$crate::io::embedded::EmbeddedAssetRegistry>(); let path = $crate::embedded_path!($source_path, $path); - let watched_path = $crate::io::embedded::watched_path(file!(), $path); - embedded.insert_asset(watched_path, &path, include_bytes!($path)); + let watched_path = $crate::io::embedded::watched_path(::core::file!(), $path); + embedded.insert_asset(watched_path, &path, ::core::include_bytes!($path)); }}; } @@ -379,8 +379,8 @@ macro_rules! load_internal_asset { ($app: ident, $handle: expr, $path_str: expr, $loader: expr) => {{ let mut assets = $app.world_mut().resource_mut::<$crate::Assets<_>>(); assets.insert($handle.id(), ($loader)( - include_str!($path_str), - std::path::Path::new(file!()) + ::core::include_str!($path_str), + ::std::path::Path::new(::core::file!()) .parent() .unwrap() .join($path_str) @@ -391,8 +391,8 @@ macro_rules! load_internal_asset { ($app: ident, $handle: ident, $path_str: expr, $loader: expr $(, $param:expr)+) => {{ let mut assets = $app.world_mut().resource_mut::<$crate::Assets<_>>(); assets.insert($handle.id(), ($loader)( - include_str!($path_str), - std::path::Path::new(file!()) + ::core::include_str!($path_str), + ::std::path::Path::new(::core::file!()) .parent() .unwrap() .join($path_str) @@ -411,8 +411,8 @@ macro_rules! load_internal_binary_asset { .insert( $handle.id(), ($loader)( - include_bytes!($path_str).as_ref(), - std::path::Path::new(file!()) + ::core::include_bytes!($path_str).as_ref(), + ::std::path::Path::new(::core::file!()) .parent() .unwrap() .join($path_str) diff --git a/crates/bevy_ecs/src/label.rs b/crates/bevy_ecs/src/label.rs index 9d3f6f838dc47..096ac322120c5 100644 --- a/crates/bevy_ecs/src/label.rs +++ b/crates/bevy_ecs/src/label.rs @@ -106,18 +106,18 @@ macro_rules! define_label { ) => { $(#[$label_attr])* - pub trait $label_trait_name: Send + Sync + ::core::fmt::Debug + $crate::label::DynEq + $crate::label::DynHash { + pub trait $label_trait_name: ::core::marker::Send + ::core::marker::Sync + ::core::fmt::Debug + $crate::label::DynEq + $crate::label::DynHash { $($trait_extra_methods)* /// Clones this ` - #[doc = stringify!($label_trait_name)] + #[doc = ::core::stringify!($label_trait_name)] ///`. fn dyn_clone(&self) -> $crate::label::Box; /// Returns an [`Interned`] value corresponding to `self`. fn intern(&self) -> $crate::intern::Interned - where Self: Sized { + where Self: ::core::marker::Sized { $interner_name.intern(self) } } @@ -136,13 +136,13 @@ macro_rules! define_label { } } - impl PartialEq for dyn $label_trait_name { + impl ::core::cmp::PartialEq for dyn $label_trait_name { fn eq(&self, other: &Self) -> bool { self.dyn_eq(other) } } - impl Eq for dyn $label_trait_name {} + impl ::core::cmp::Eq for dyn $label_trait_name {} impl ::core::hash::Hash for dyn $label_trait_name { fn hash(&self, state: &mut H) { diff --git a/crates/bevy_gizmos/src/transform_gizmo.rs b/crates/bevy_gizmos/src/transform_gizmo.rs index 6ceeaa89dcb11..6ffaa687dc77d 100644 --- a/crates/bevy_gizmos/src/transform_gizmo.rs +++ b/crates/bevy_gizmos/src/transform_gizmo.rs @@ -253,27 +253,29 @@ impl Plugin for TransformGizmoPlugin { macro_rules! resolve_gizmo_camera { ($marked:expr, $all:expr) => {{ let mut marked_iter = $marked.iter(); - if let Some(first) = marked_iter.next() { + if let ::core::option::Option::Some(first) = marked_iter.next() { if marked_iter.next().is_some() { bevy_log::warn_once!( "Multiple cameras have the TransformGizmoCamera component; \ using the first one found." ); } - Some(first) + ::core::option::Option::Some(first) } else { let mut all_iter = $all.iter(); match (all_iter.next(), all_iter.next()) { - (Some(cam), None) => Some(cam), - (Some(_), Some(_)) => { + (::core::option::Option::Some(cam), ::core::option::Option::None) => { + ::core::option::Option::Some(cam) + } + (::core::option::Option::Some(_), ::core::option::Option::Some(_)) => { bevy_log::warn_once!( "Multiple cameras exist but none has the TransformGizmoCamera \ component. Add TransformGizmoCamera to the camera the gizmo \ should use." ); - None + ::core::option::Option::None } - _ => None, + _ => ::core::option::Option::None, } } }}; diff --git a/crates/bevy_pbr/src/render/mesh.rs b/crates/bevy_pbr/src/render/mesh.rs index 253540c6dbcb9..182fa1712c5fd 100644 --- a/crates/bevy_pbr/src/render/mesh.rs +++ b/crates/bevy_pbr/src/render/mesh.rs @@ -72,7 +72,7 @@ use bevy_transform::components::GlobalTransform; use bevy_utils::{default, Parallel, TypeIdMap}; use core::any::TypeId; use core::iter; -use core::mem::{offset_of, size_of}; +use core::mem::size_of; use core::sync::atomic::{AtomicU64, Ordering}; use indexmap::IndexSet; use material_bind_groups::MaterialBindingId; diff --git a/crates/bevy_platform/src/cfg.rs b/crates/bevy_platform/src/cfg.rs index 6f86ce187350e..3cedc409b443c 100644 --- a/crates/bevy_platform/src/cfg.rs +++ b/crates/bevy_platform/src/cfg.rs @@ -212,14 +212,14 @@ macro_rules! define_alias { $(#[$p_meta])* #[doc(inline)] /// - #[doc = concat!("This macro passes the provided code because `#[cfg(", stringify!($meta), ")]` is currently active.")] + #[doc = ::core::concat!("This macro passes the provided code because `#[cfg(", ::core::stringify!($meta), ")]` is currently active.")] pub use $crate::enabled as $p; } _ => { $(#[$p_meta])* #[doc(inline)] /// - #[doc = concat!("This macro suppresses the provided code because `#[cfg(", stringify!($meta), ")]` is _not_ currently active.")] + #[doc = ::core::concat!("This macro suppresses the provided code because `#[cfg(", ::core::stringify!($meta), ")]` is _not_ currently active.")] pub use $crate::disabled as $p; } } diff --git a/crates/bevy_ptr/src/lib.rs b/crates/bevy_ptr/src/lib.rs index 1d20535d914f7..dda55705e4673 100644 --- a/crates/bevy_ptr/src/lib.rs +++ b/crates/bevy_ptr/src/lib.rs @@ -1273,7 +1273,7 @@ impl DebugEnsureAligned for *mut T { #[macro_export] macro_rules! move_as_ptr { ($value: ident) => { - let mut $value = core::mem::MaybeUninit::new($value); + let mut $value = ::core::mem::MaybeUninit::new($value); // SAFETY: // - This macro shadows a MaybeUninit value that took ownership of the original value. // it is impossible to refer to the original value, preventing further access after @@ -1459,11 +1459,11 @@ macro_rules! deconstruct_moving_ptr { let value = &mut *ptr; // Ensure that each field index exists and is mentioned only once // Ensure that the struct is not `repr(packed)` and that we may take references to fields - core::hint::black_box(($(&mut value.$field_index,)*)); + ::core::hint::black_box(($(&mut value.$field_index,)*)); // Ensure that `ptr` is a tuple and not something that derefs to it // Ensure that the number of patterns matches the number of fields fn unreachable(_index: usize) -> T { - unreachable!() + ::core::unreachable!() } *value = ($(unreachable($field_index),)*); }; @@ -1473,21 +1473,21 @@ macro_rules! deconstruct_moving_ptr { // - `mem::forget` is called on `self` immediately after these calls // - Each field is distinct, since otherwise the block of code above would fail compilation $(let $pattern = unsafe { ptr.move_field(|f| &raw mut (*f).$field_index) };)* - core::mem::forget(ptr); + ::core::mem::forget(ptr); }; ({ let MaybeUninit:: { $($field_index:tt: $pattern:pat),* $(,)? } = $ptr:expr ;}) => { // Specify the type to make sure the `mem::forget` doesn't forget a mere `&mut MovingPtr` - let mut ptr: $crate::MovingPtr, _> = $ptr; + let mut ptr: $crate::MovingPtr<::core::mem::MaybeUninit<_>, _> = $ptr; let _ = || { // SAFETY: This closure is never called let value = unsafe { ptr.assume_init_mut() }; // Ensure that each field index exists and is mentioned only once // Ensure that the struct is not `repr(packed)` and that we may take references to fields - core::hint::black_box(($(&mut value.$field_index,)*)); + ::core::hint::black_box(($(&mut value.$field_index,)*)); // Ensure that `ptr` is a tuple and not something that derefs to it // Ensure that the number of patterns matches the number of fields fn unreachable(_index: usize) -> T { - unreachable!() + ::core::unreachable!() } *value = ($(unreachable($field_index),)*); }; @@ -1497,7 +1497,7 @@ macro_rules! deconstruct_moving_ptr { // - `mem::forget` is called on `self` immediately after these calls // - Each field is distinct, since otherwise the block of code above would fail compilation $(let $pattern = unsafe { ptr.move_maybe_uninit_field(|f| &raw mut (*f).$field_index) };)* - core::mem::forget(ptr); + ::core::mem::forget(ptr); }; ({ let $struct_name:ident { $($field_index:tt$(: $pattern:pat)?),* $(,)? } = $ptr:expr ;}) => { // Specify the type to make sure the `mem::forget` doesn't forget a mere `&mut MovingPtr` @@ -1508,7 +1508,7 @@ macro_rules! deconstruct_moving_ptr { // Ensure that each field is on the struct and not accessed using autoref let $struct_name { $($field_index: _),* } = value; // Ensure that the struct is not `repr(packed)` and that we may take references to fields - core::hint::black_box(($(&mut value.$field_index),*)); + ::core::hint::black_box(($(&mut value.$field_index),*)); // Ensure that `ptr` is a `$struct_name` and not just something that derefs to it let value: *mut _ = value; // SAFETY: This closure is never called @@ -1520,11 +1520,11 @@ macro_rules! deconstruct_moving_ptr { // - `mem::forget` is called on `self` immediately after these calls // - Each field is distinct, since otherwise the block of code above would fail compilation $(let $crate::get_pattern!($field_index$(: $pattern)?) = unsafe { ptr.move_field(|f| &raw mut (*f).$field_index) };)* - core::mem::forget(ptr); + ::core::mem::forget(ptr); }; ({ let MaybeUninit::<$struct_name:ident> { $($field_index:tt$(: $pattern:pat)?),* $(,)? } = $ptr:expr ;}) => { // Specify the type to make sure the `mem::forget` doesn't forget a mere `&mut MovingPtr` - let mut ptr: $crate::MovingPtr, _> = $ptr; + let mut ptr: $crate::MovingPtr<::core::mem::MaybeUninit<_>, _> = $ptr; let _ = || { // SAFETY: This closure is never called let value = unsafe { ptr.assume_init_mut() }; @@ -1532,7 +1532,7 @@ macro_rules! deconstruct_moving_ptr { // Ensure that each field is on the struct and not accessed using autoref let $struct_name { $($field_index: _),* } = value; // Ensure that the struct is not `repr(packed)` and that we may take references to fields - core::hint::black_box(($(&mut value.$field_index),*)); + ::core::hint::black_box(($(&mut value.$field_index),*)); // Ensure that `ptr` is a `$struct_name` and not just something that derefs to it let value: *mut _ = value; // SAFETY: This closure is never called @@ -1544,6 +1544,6 @@ macro_rules! deconstruct_moving_ptr { // - `mem::forget` is called on `self` immediately after these calls // - Each field is distinct, since otherwise the block of code above would fail compilation $(let $crate::get_pattern!($field_index$(: $pattern)?) = unsafe { ptr.move_maybe_uninit_field(|f| &raw mut (*f).$field_index) };)* - core::mem::forget(ptr); + ::core::mem::forget(ptr); }; } diff --git a/crates/bevy_reflect/src/lib.rs b/crates/bevy_reflect/src/lib.rs index dc0d0843caf1c..a09abe1d2a5d4 100644 --- a/crates/bevy_reflect/src/lib.rs +++ b/crates/bevy_reflect/src/lib.rs @@ -709,6 +709,7 @@ pub mod __macro_exports { pub use ::alloc::{ borrow::{Cow, ToOwned}, boxed::Box, + format, string::ToString, }; } diff --git a/crates/bevy_reflect/src/map.rs b/crates/bevy_reflect/src/map.rs index a691e8e7507cc..245a9a70df0c4 100644 --- a/crates/bevy_reflect/src/map.rs +++ b/crates/bevy_reflect/src/map.rs @@ -11,7 +11,7 @@ use crate::{ MaybeTyped, PartialReflect, Reflect, ReflectKind, ReflectMut, ReflectOwned, ReflectRef, Type, TypeInfo, TypePath, }; -use alloc::{boxed::Box, format, vec::Vec}; +use alloc::{boxed::Box, vec::Vec}; /// A trait used to power [map-like] operations via [reflection]. /// @@ -198,16 +198,16 @@ macro_rules! hash_error { ( $key:expr ) => {{ let type_path = (*$key).reflect_type_path(); if !$key.is_dynamic() { - format!( + $crate::__macro_exports::alloc_utils::format!( "the given key of type `{}` does not support hashing", type_path ) } else { match (*$key).get_represented_type_info() { // Handle dynamic types that do not represent a type (i.e a plain `DynamicStruct`): - None => format!("the dynamic type `{}` does not support hashing", type_path), + ::core::option::Option::None => $crate::__macro_exports::alloc_utils::format!("the dynamic type `{}` does not support hashing", type_path), // Handle dynamic types that do represent a type (i.e. a `DynamicStruct` proxying `Foo`): - Some(s) => format!( + ::core::option::Option::Some(s) => $crate::__macro_exports::alloc_utils::format!( "the dynamic type `{}` (representing `{}`) does not support hashing", type_path, s.type_path() diff --git a/crates/bevy_reflect/src/set.rs b/crates/bevy_reflect/src/set.rs index 815ae920a1826..145a58d4f6339 100644 --- a/crates/bevy_reflect/src/set.rs +++ b/crates/bevy_reflect/src/set.rs @@ -1,7 +1,7 @@ //! A trait used to power [set-like] operations via reflection. //! //! [set-like]: https://doc.rust-lang.org/stable/std/collections/struct.HashSet.html -use alloc::{boxed::Box, format, vec::Vec}; +use alloc::{boxed::Box, vec::Vec}; use core::fmt::{Debug, Formatter}; use bevy_platform::collections::{hash_table::OccupiedEntry as HashTableOccupiedEntry, HashTable}; diff --git a/crates/bevy_render/src/render_resource/atomic_pod.rs b/crates/bevy_render/src/render_resource/atomic_pod.rs index 5a1e5a26db5e1..bd529ff0bb038 100644 --- a/crates/bevy_render/src/render_resource/atomic_pod.rs +++ b/crates/bevy_render/src/render_resource/atomic_pod.rs @@ -122,7 +122,7 @@ macro_rules! impl_atomic_pod { $(, field($field_name: ident : $field_ty: ty, $getter: ident $(, $($setter: ident)?)?))* $(,)? ) => { - #[derive(Default, ::bevy_derive::Deref, ::bevy_derive::DerefMut)] + #[derive(::core::default::Default, ::bevy_derive::Deref, ::bevy_derive::DerefMut)] #[repr(transparent)] pub struct $blob_ty( pub [::core::sync::atomic::AtomicU32; ::core::mem::size_of::<$pod_ty>() / 4], @@ -132,7 +132,7 @@ macro_rules! impl_atomic_pod { type Blob = $blob_ty; fn read_from_blob(blob: &Self::Blob) -> Self { - const _ASSERT_POD_TYPE_SIZE: () = assert!( + const _ASSERT_POD_TYPE_SIZE: () = ::core::assert!( ::core::mem::size_of::<$pod_ty>() % 4 == 0 ); @@ -174,7 +174,7 @@ macro_rules! impl_atomic_pod { $( $( pub fn $getter(&self) -> $field_ty { - const _ASSERT_FIELD_SIZE: () = assert!( + const _ASSERT_FIELD_SIZE: () = ::core::assert!( ::core::mem::size_of::<$field_ty>() % 4 == 0 ); @@ -183,7 +183,7 @@ macro_rules! impl_atomic_pod { // multiple of 4. let words: [u32; ::core::mem::size_of::<$field_ty>() / 4] = ::core::array::from_fn(|i| { - self.0[offset_of!($pod_ty, $field_name) / 4 + i] + self.0[::core::mem::offset_of!($pod_ty, $field_name) / 4 + i] .load(::bevy_platform::sync::atomic::Ordering::Relaxed) }); *::bytemuck::must_cast_ref(&words) @@ -197,7 +197,7 @@ macro_rules! impl_atomic_pod { let words: [u32; ::core::mem::size_of::<$field_ty>() / 4] = ::bytemuck::must_cast(value); for i in 0..(::core::mem::size_of::<$field_ty>() / 4) { - self.0[offset_of!($pod_ty, $field_name) / 4 + i] + self.0[::core::mem::offset_of!($pod_ty, $field_name) / 4 + i] .store(words[i], ::bevy_platform::sync::atomic::Ordering::Relaxed); } } diff --git a/crates/bevy_shader/src/lib.rs b/crates/bevy_shader/src/lib.rs index d31bc94e5d8cc..fa20be2347d8a 100644 --- a/crates/bevy_shader/src/lib.rs +++ b/crates/bevy_shader/src/lib.rs @@ -34,6 +34,6 @@ macro_rules! load_shader_library { $path $(,$settings)? ); - core::mem::forget(handle); + ::core::mem::forget(handle); } } diff --git a/crates/bevy_utils/src/atomic_id.rs b/crates/bevy_utils/src/atomic_id.rs index 6d57f50989f98..6e0265cd39f10 100644 --- a/crates/bevy_utils/src/atomic_id.rs +++ b/crates/bevy_utils/src/atomic_id.rs @@ -9,8 +9,8 @@ macro_rules! define_atomic_id { /// /// Note that this means the id space is process-wide, as such it may potentially be exhausted /// by a combination of long-running processes and multiple bevy `World`s, at which point we panic. - #[derive(Copy, Clone, Hash, Eq, PartialEq, PartialOrd, Ord, Debug)] - pub struct $atomic_id_type(core::num::NonZero); + #[derive(::core::marker::Copy, ::core::clone::Clone, ::core::hash::Hash, ::core::cmp::Eq, ::core::cmp::PartialEq, ::core::cmp::PartialOrd, ::core::cmp::Ord, ::core::fmt::Debug)] + pub struct $atomic_id_type(::core::num::NonZero); impl $atomic_id_type { /// Creates a new id via fetch_add atomic on a static global. @@ -19,28 +19,28 @@ macro_rules! define_atomic_id { reason = "Implementing the `Default` trait on atomic IDs would imply that two `::default()` equal each other. By only implementing `new()`, we indicate that each atomic ID created will be unique." )] pub fn new() -> Self { - use core::sync::atomic::{AtomicU32, Ordering}; + use ::core::sync::atomic::{AtomicU32, Ordering}; static COUNTER: AtomicU32 = AtomicU32::new(1); let counter = COUNTER.fetch_add(1, Ordering::Relaxed); - Self(core::num::NonZero::::new(counter).unwrap_or_else(|| { - panic!( + Self(::core::num::NonZero::::new(counter).unwrap_or_else(|| { + ::core::panic!( "The system ran out of unique `{}`s.", - stringify!($atomic_id_type) + ::core::stringify!($atomic_id_type) ); })) } } - impl From<$atomic_id_type> for core::num::NonZero { + impl ::core::convert::From<$atomic_id_type> for ::core::num::NonZero { fn from(value: $atomic_id_type) -> Self { value.0 } } - impl From> for $atomic_id_type { - fn from(value: core::num::NonZero) -> Self { + impl ::core::convert::From<::core::num::NonZero> for $atomic_id_type { + fn from(value: ::core::num::NonZero) -> Self { Self(value) } }