@@ -82,13 +82,13 @@ mod global_error_handler {
82
82
Ordering :: { AcqRel , Acquire , Relaxed } ,
83
83
} ;
84
84
85
- // The default global error handler, cast to a data pointer as Rust doesn't
86
- // currently have a way to express atomic function pointers.
87
- // Should we add support for a platform on which function pointers and data pointers
88
- // have different sizes, the transmutation back will fail to compile. In that case,
89
- // we can replace the atomic pointer with a regular pointer protected by a `RwLock`
90
- // on only those platforms.
91
- // SAFETY: Only accessible from within this module.
85
+ /// The default global error handler, cast to a data pointer as Rust doesn't
86
+ /// currently have a way to express atomic function pointers.
87
+ /// Should we add support for a platform on which function pointers and data pointers
88
+ /// have different sizes, the transmutation back will fail to compile. In that case,
89
+ /// we can replace the atomic pointer with a regular pointer protected by a `RwLock`
90
+ /// on only those platforms.
91
+ /// SAFETY: Only accessible from within this module.
92
92
static HANDLER : AtomicPtr < ( ) > = AtomicPtr :: new ( panic as * mut ( ) ) ;
93
93
94
94
/// Set the global error handler.
@@ -107,7 +107,7 @@ mod global_error_handler {
107
107
/// To use this error handler in your app for custom error handling logic:
108
108
///
109
109
/// ```rust
110
- /// use bevy_ecs::error::{default_error_handler, BevyError, ErrorContext, panic };
110
+ /// use bevy_ecs::error::{default_error_handler, BevyError, ErrorContext};
111
111
///
112
112
/// fn handle_errors(error: BevyError, ctx: ErrorContext) {
113
113
/// let error_handler = default_error_handler();
@@ -123,7 +123,7 @@ mod global_error_handler {
123
123
/// [`default_error_handler`]: super::default_error_handler
124
124
pub fn set_global_default_error_handler ( handler : fn ( BevyError , ErrorContext ) ) {
125
125
// Prevent the handler from being set multiple times.
126
- // We use a seperate atomic instead of trying `compare_exchange` on `HANDLER_ADDRESS`
126
+ // We use a separate atomic instead of trying `compare_exchange` on `HANDLER_ADDRESS`
127
127
// because Rust doesn't guarantee that function addresses are unique.
128
128
static INITIALIZED : AtomicBool = AtomicBool :: new ( false ) ;
129
129
if INITIALIZED
@@ -137,6 +137,8 @@ mod global_error_handler {
137
137
138
138
/// The default error handler. This defaults to [`panic`],
139
139
/// but you can override this behavior via [`set_global_default_error_handler`].
140
+ ///
141
+ /// [`panic`]: super::panic
140
142
#[ inline]
141
143
pub fn default_error_handler ( ) -> fn ( BevyError , ErrorContext ) {
142
144
// The error handler must have been already set from the perspective of this thread,
0 commit comments