File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
crates/byondapi-macros/src Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,13 @@ pub fn bind(attr: TokenStream, item: TokenStream) -> TokenStream {
130
130
Ok ( val) => val,
131
131
Err ( e) => {
132
132
let error_string = :: byondapi:: value:: ByondValue :: try_from( :: std:: format!( "{e:?}" ) ) . unwrap( ) ;
133
- :: byondapi:: global_call:: call_global_id( byond_string!( "stack_trace" ) , & [ error_string] ) . unwrap( ) ;
133
+ :: byondapi:: global_call:: call_global_id( {
134
+ static STACK_TRACE : :: std:: sync:: OnceLock <u32 > = :: std:: sync:: OnceLock :: new( ) ;
135
+ * STACK_TRACE . get_or_init( || :: byondapi:: byond_string:: str_id_of( "stack_trace" )
136
+ . expect( "byondapi-rs implicitly expects stack_trace to exist as a proc for error reporting purposes, this proc doesn't exist!" )
137
+ )
138
+ }
139
+ , & [ error_string] ) . unwrap( ) ;
134
140
:: byondapi:: value:: ByondValue :: null( )
135
141
}
136
142
}
@@ -232,7 +238,13 @@ pub fn bind_raw_args(attr: TokenStream, item: TokenStream) -> TokenStream {
232
238
Ok ( val) => val,
233
239
Err ( e) => {
234
240
let error_string = :: byondapi:: value:: ByondValue :: try_from( :: std:: format!( "{e:?}" ) ) . unwrap( ) ;
235
- :: byondapi:: global_call:: call_global_id( byond_string!( "stack_trace" ) , & [ error_string] ) . unwrap( ) ;
241
+ :: byondapi:: global_call:: call_global_id( {
242
+ static STACK_TRACE : :: std:: sync:: OnceLock <u32 > = :: std:: sync:: OnceLock :: new( ) ;
243
+ * STACK_TRACE . get_or_init( || :: byondapi:: byond_string:: str_id_of( "stack_trace" )
244
+ . expect( "byondapi-rs implicitly expects stack_trace to exist as a proc for error reporting purposes, this proc doesn't exist!" )
245
+ )
246
+ }
247
+ , & [ error_string] ) . unwrap( ) ;
236
248
:: byondapi:: value:: ByondValue :: null( )
237
249
}
238
250
}
You can’t perform that action at this time.
0 commit comments