File tree Expand file tree Collapse file tree 4 files changed +40
-4
lines changed Expand file tree Collapse file tree 4 files changed +40
-4
lines changed Original file line number Diff line number Diff line change @@ -228,13 +228,22 @@ extern "C-unwind" {
228
228
//
229
229
#[ cfg_attr( all( windows, raw_dylib) , link( name = "lua51" , kind = "raw-dylib" ) ) ]
230
230
extern "C-unwind" {
231
- pub fn lua_error ( L : * mut lua_State ) -> !;
231
+ #[ link_name = "lua_error" ]
232
+ fn lua_error_ ( L : * mut lua_State ) -> c_int ;
232
233
pub fn lua_next ( L : * mut lua_State , idx : c_int ) -> c_int ;
233
234
pub fn lua_concat ( L : * mut lua_State , n : c_int ) ;
234
235
pub fn lua_getallocf ( L : * mut lua_State , ud : * mut * mut c_void ) -> lua_Alloc ;
235
236
pub fn lua_setallocf ( L : * mut lua_State , f : lua_Alloc , ud : * mut c_void ) ;
236
237
}
237
238
239
+ // lua_error does not return but is declared to return int, and Rust translates
240
+ // ! to void which can cause link-time errors if the platform linker is aware
241
+ // of return types and requires they match (for example: wasm does this).
242
+ pub unsafe fn lua_error ( L : * mut lua_State ) -> ! {
243
+ lua_error_ ( L ) ;
244
+ unreachable ! ( ) ;
245
+ }
246
+
238
247
//
239
248
// Some useful macros (implemented as Rust functions)
240
249
//
Original file line number Diff line number Diff line change @@ -308,14 +308,23 @@ extern "C-unwind" {
308
308
//
309
309
// Miscellaneous functions
310
310
//
311
- pub fn lua_error ( L : * mut lua_State ) -> !;
311
+ #[ link_name = "lua_error" ]
312
+ fn lua_error_ ( L : * mut lua_State ) -> c_int ;
312
313
pub fn lua_next ( L : * mut lua_State , idx : c_int ) -> c_int ;
313
314
pub fn lua_concat ( L : * mut lua_State , n : c_int ) ;
314
315
pub fn lua_len ( L : * mut lua_State , idx : c_int ) ;
315
316
pub fn lua_getallocf ( L : * mut lua_State , ud : * mut * mut c_void ) -> lua_Alloc ;
316
317
pub fn lua_setallocf ( L : * mut lua_State , f : lua_Alloc , ud : * mut c_void ) ;
317
318
}
318
319
320
+ // lua_error does not return but is declared to return int, and Rust translates
321
+ // ! to void which can cause link-time errors if the platform linker is aware
322
+ // of return types and requires they match (for example: wasm does this).
323
+ pub unsafe fn lua_error ( L : * mut lua_State ) -> ! {
324
+ lua_error_ ( L ) ;
325
+ unreachable ! ( ) ;
326
+ }
327
+
319
328
//
320
329
// Some useful macros (implemented as Rust functions)
321
330
//
Original file line number Diff line number Diff line change @@ -314,7 +314,8 @@ extern "C-unwind" {
314
314
//
315
315
// Miscellaneous functions
316
316
//
317
- pub fn lua_error ( L : * mut lua_State ) -> !;
317
+ #[ link_name = "lua_error" ]
318
+ fn lua_error_ ( L : * mut lua_State ) -> c_int ;
318
319
pub fn lua_next ( L : * mut lua_State , idx : c_int ) -> c_int ;
319
320
pub fn lua_concat ( L : * mut lua_State , n : c_int ) ;
320
321
pub fn lua_len ( L : * mut lua_State , idx : c_int ) ;
@@ -323,6 +324,14 @@ extern "C-unwind" {
323
324
pub fn lua_setallocf ( L : * mut lua_State , f : lua_Alloc , ud : * mut c_void ) ;
324
325
}
325
326
327
+ // lua_error does not return but is declared to return int, and Rust translates
328
+ // ! to void which can cause link-time errors if the platform linker is aware
329
+ // of return types and requires they match (for example: wasm does this).
330
+ pub unsafe fn lua_error ( L : * mut lua_State ) -> ! {
331
+ lua_error_ ( L ) ;
332
+ unreachable ! ( ) ;
333
+ }
334
+
326
335
//
327
336
// Some useful macros (implemented as Rust functions)
328
337
//
Original file line number Diff line number Diff line change @@ -343,7 +343,8 @@ extern "C-unwind" {
343
343
//
344
344
// Miscellaneous functions
345
345
//
346
- pub fn lua_error ( L : * mut lua_State ) -> !;
346
+ #[ link_name = "lua_error" ]
347
+ fn lua_error_ ( L : * mut lua_State ) -> c_int ;
347
348
pub fn lua_next ( L : * mut lua_State , idx : c_int ) -> c_int ;
348
349
pub fn lua_concat ( L : * mut lua_State , n : c_int ) ;
349
350
pub fn lua_len ( L : * mut lua_State , idx : c_int ) ;
@@ -355,6 +356,14 @@ extern "C-unwind" {
355
356
pub fn lua_closeslot ( L : * mut lua_State , idx : c_int ) ;
356
357
}
357
358
359
+ // lua_error does not return but is declared to return int, and Rust translates
360
+ // ! to void which can cause link-time errors if the platform linker is aware
361
+ // of return types and requires they match (for example: wasm does this).
362
+ pub unsafe fn lua_error ( L : * mut lua_State ) -> ! {
363
+ lua_error_ ( L ) ;
364
+ unreachable ! ( ) ;
365
+ }
366
+
358
367
//
359
368
// Some useful macros (implemented as Rust functions)
360
369
//
You can’t perform that action at this time.
0 commit comments