Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benches/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
#[macro_export]
macro_rules! bench {
($name:literal) => {
concat!(module_path!(), "::", $name)
::core::concat!(::core::module_path!(), "::", $name)
};
}
9 changes: 5 additions & 4 deletions crates/bevy_animation/src/animation_curves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
)
};
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_animation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
14 changes: 7 additions & 7 deletions crates/bevy_app/src/plugin_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, "`")?
)])+)?
$(
Expand All @@ -158,7 +158,7 @@ macro_rules! plugin_group {
$(#[$plugin_meta])*
{
const _: () = {
const fn check_default<T: Default>() {}
const fn check_default<T: ::core::default::Default>() {}
check_default::<$($plugin_path::)*$plugin_name>();
};

Expand All @@ -170,7 +170,7 @@ macro_rules! plugin_group {
$(#[$plugin_group_meta])*
{
const _: () = {
const fn check_default<T: Default>() {}
const fn check_default<T: ::core::default::Default>() {}
check_default::<$($plugin_group_path::)*$plugin_group_name>();
};

Expand All @@ -182,7 +182,7 @@ macro_rules! plugin_group {
$(#[$hidden_plugin_meta])*
{
const _: () = {
const fn check_default<T: Default>() {}
const fn check_default<T: ::core::default::Default>() {}
check_default::<$($hidden_plugin_path::)*$hidden_plugin_name>();
};

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ impl<A: Asset> TryFrom<UntypedHandle> for Handle<A> {
#[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)
}};
}

Expand Down
20 changes: 10 additions & 10 deletions crates/bevy_asset/src/io/embedded/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
}};
Expand Down Expand Up @@ -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));
}};
}

Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_ecs/src/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<dyn $label_trait_name>;

/// Returns an [`Interned`] value corresponding to `self`.
fn intern(&self) -> $crate::intern::Interned<dyn $label_trait_name>
where Self: Sized {
where Self: ::core::marker::Sized {
$interner_name.intern(self)
}
}
Expand All @@ -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<H: ::core::hash::Hasher>(&self, state: &mut H) {
Expand Down
14 changes: 8 additions & 6 deletions crates/bevy_gizmos/src/transform_gizmo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}};
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/render/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_platform/src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
26 changes: 13 additions & 13 deletions crates/bevy_ptr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ impl<T: Sized> 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
Expand Down Expand Up @@ -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<T>(_index: usize) -> T {
unreachable!()
::core::unreachable!()
}
*value = ($(unreachable($field_index),)*);
};
Expand All @@ -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::<tuple> { $($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<core::mem::MaybeUninit<_>, _> = $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<T>(_index: usize) -> T {
unreachable!()
::core::unreachable!()
}
*value = ($(unreachable($field_index),)*);
};
Expand All @@ -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`
Expand All @@ -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
Expand All @@ -1520,19 +1520,19 @@ 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<core::mem::MaybeUninit<_>, _> = $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 is mentioned only once
// 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
Expand All @@ -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);
};
}
1 change: 1 addition & 0 deletions crates/bevy_reflect/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ pub mod __macro_exports {
pub use ::alloc::{
borrow::{Cow, ToOwned},
boxed::Box,
format,
string::ToString,
};
}
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_reflect/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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].
///
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_reflect/src/set.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
Loading
Loading