Skip to content

Commit 8b7a850

Browse files
committed
mlua-sys: Prepare to 2024 edition
1 parent a4ff68a commit 8b7a850

File tree

20 files changed

+63
-62
lines changed

20 files changed

+63
-62
lines changed

mlua-sys/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//! Low level bindings to Lua 5.4/5.3/5.2/5.1 (including LuaJIT) and Luau.
22
3-
#![allow(non_camel_case_types, non_snake_case, dead_code)]
3+
#![allow(non_camel_case_types, non_snake_case)]
44
#![allow(clippy::missing_safety_doc)]
5+
#![allow(unsafe_op_in_unsafe_fn)]
56
#![doc(test(attr(deny(warnings))))]
67
#![cfg_attr(docsrs, feature(doc_cfg))]
78

mlua-sys/src/lua51/lauxlib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub struct luaL_Reg {
1818
}
1919

2020
#[cfg_attr(all(windows, raw_dylib), link(name = "lua51", kind = "raw-dylib"))]
21-
extern "C-unwind" {
21+
unsafe extern "C-unwind" {
2222
pub fn luaL_register(L: *mut lua_State, libname: *const c_char, l: *const luaL_Reg);
2323
#[link_name = "luaL_getmetafield"]
2424
pub fn luaL_getmetafield_(L: *mut lua_State, obj: c_int, e: *const c_char) -> c_int;
@@ -61,7 +61,7 @@ pub const LUA_NOREF: c_int = -2;
6161
pub const LUA_REFNIL: c_int = -1;
6262

6363
#[cfg_attr(all(windows, raw_dylib), link(name = "lua51", kind = "raw-dylib"))]
64-
extern "C-unwind" {
64+
unsafe extern "C-unwind" {
6565
pub fn luaL_ref(L: *mut lua_State, t: c_int) -> c_int;
6666
pub fn luaL_unref(L: *mut lua_State, t: c_int, r#ref: c_int);
6767

mlua-sys/src/lua51/lua.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub type lua_Alloc =
9090
unsafe extern "C" fn(ud: *mut c_void, ptr: *mut c_void, osize: usize, nsize: usize) -> *mut c_void;
9191

9292
#[cfg_attr(all(windows, raw_dylib), link(name = "lua51", kind = "raw-dylib"))]
93-
extern "C-unwind" {
93+
unsafe extern "C-unwind" {
9494
//
9595
// State manipulation
9696
//
@@ -220,15 +220,15 @@ pub const LUA_GCSETPAUSE: c_int = 6;
220220
pub const LUA_GCSETSTEPMUL: c_int = 7;
221221

222222
#[cfg_attr(all(windows, raw_dylib), link(name = "lua51", kind = "raw-dylib"))]
223-
extern "C-unwind" {
223+
unsafe extern "C-unwind" {
224224
pub fn lua_gc(L: *mut lua_State, what: c_int, data: c_int) -> c_int;
225225
}
226226

227227
//
228228
// Miscellaneous functions
229229
//
230230
#[cfg_attr(all(windows, raw_dylib), link(name = "lua51", kind = "raw-dylib"))]
231-
extern "C-unwind" {
231+
unsafe extern "C-unwind" {
232232
#[link_name = "lua_error"]
233233
fn lua_error_(L: *mut lua_State) -> c_int;
234234
pub fn lua_next(L: *mut lua_State, idx: c_int) -> c_int;
@@ -370,7 +370,7 @@ pub const LUA_MASKCOUNT: c_int = 1 << (LUA_HOOKCOUNT as usize);
370370
pub type lua_Hook = unsafe extern "C-unwind" fn(L: *mut lua_State, ar: *mut lua_Debug);
371371

372372
#[cfg_attr(all(windows, raw_dylib), link(name = "lua51", kind = "raw-dylib"))]
373-
extern "C-unwind" {
373+
unsafe extern "C-unwind" {
374374
pub fn lua_getstack(L: *mut lua_State, level: c_int, ar: *mut lua_Debug) -> c_int;
375375
pub fn lua_getinfo(L: *mut lua_State, what: *const c_char, ar: *mut lua_Debug) -> c_int;
376376
pub fn lua_getlocal(L: *mut lua_State, ar: *const lua_Debug, n: c_int) -> *const c_char;

mlua-sys/src/lua51/lualib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub const LUA_JITLIBNAME: *const c_char = cstr!("jit");
2121
pub const LUA_FFILIBNAME: *const c_char = cstr!("ffi");
2222

2323
#[cfg_attr(all(windows, raw_dylib), link(name = "lua51", kind = "raw-dylib"))]
24-
extern "C-unwind" {
24+
unsafe extern "C-unwind" {
2525
pub fn luaopen_base(L: *mut lua_State) -> c_int;
2626
pub fn luaopen_table(L: *mut lua_State) -> c_int;
2727
pub fn luaopen_io(L: *mut lua_State) -> c_int;

mlua-sys/src/lua52/lauxlib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct luaL_Reg {
2121
}
2222

2323
#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))]
24-
extern "C-unwind" {
24+
unsafe extern "C-unwind" {
2525
pub fn luaL_checkversion_(L: *mut lua_State, ver: lua_Number);
2626

2727
#[link_name = "luaL_getmetafield"]
@@ -69,7 +69,7 @@ pub const LUA_NOREF: c_int = -2;
6969
pub const LUA_REFNIL: c_int = -1;
7070

7171
#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))]
72-
extern "C-unwind" {
72+
unsafe extern "C-unwind" {
7373
pub fn luaL_ref(L: *mut lua_State, t: c_int) -> c_int;
7474
pub fn luaL_unref(L: *mut lua_State, t: c_int, r#ref: c_int);
7575

@@ -82,7 +82,7 @@ pub unsafe fn luaL_loadfile(L: *mut lua_State, f: *const c_char) -> c_int {
8282
}
8383

8484
#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))]
85-
extern "C-unwind" {
85+
unsafe extern "C-unwind" {
8686
pub fn luaL_loadbufferx(
8787
L: *mut lua_State,
8888
buff: *const c_char,

mlua-sys/src/lua52/lua.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub type lua_Alloc =
9595
unsafe extern "C" fn(ud: *mut c_void, ptr: *mut c_void, osize: usize, nsize: usize) -> *mut c_void;
9696

9797
#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))]
98-
extern "C-unwind" {
98+
unsafe extern "C-unwind" {
9999
//
100100
// State manipulation
101101
//
@@ -161,14 +161,14 @@ pub const LUA_OPLT: c_int = 1;
161161
pub const LUA_OPLE: c_int = 2;
162162

163163
#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))]
164-
extern "C-unwind" {
164+
unsafe extern "C-unwind" {
165165
pub fn lua_arith(L: *mut lua_State, op: c_int);
166166
pub fn lua_rawequal(L: *mut lua_State, idx1: c_int, idx2: c_int) -> c_int;
167167
pub fn lua_compare(L: *mut lua_State, idx1: c_int, idx2: c_int, op: c_int) -> c_int;
168168
}
169169

170170
#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))]
171-
extern "C-unwind" {
171+
unsafe extern "C-unwind" {
172172
//
173173
// Push functions (C -> stack)
174174
//
@@ -257,7 +257,7 @@ pub unsafe fn lua_pcall(L: *mut lua_State, n: c_int, r: c_int, f: c_int) -> c_in
257257
}
258258

259259
#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))]
260-
extern "C-unwind" {
260+
unsafe extern "C-unwind" {
261261
//
262262
// Coroutine functions
263263
//
@@ -289,12 +289,12 @@ pub const LUA_GCGEN: c_int = 10;
289289
pub const LUA_GCINC: c_int = 11;
290290

291291
#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))]
292-
extern "C-unwind" {
292+
unsafe extern "C-unwind" {
293293
pub fn lua_gc(L: *mut lua_State, what: c_int, data: c_int) -> c_int;
294294
}
295295

296296
#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))]
297-
extern "C-unwind" {
297+
unsafe extern "C-unwind" {
298298
//
299299
// Miscellaneous functions
300300
//
@@ -448,7 +448,7 @@ pub const LUA_MASKCOUNT: c_int = 1 << (LUA_HOOKCOUNT as usize);
448448
pub type lua_Hook = unsafe extern "C-unwind" fn(L: *mut lua_State, ar: *mut lua_Debug);
449449

450450
#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))]
451-
extern "C-unwind" {
451+
unsafe extern "C-unwind" {
452452
pub fn lua_getstack(L: *mut lua_State, level: c_int, ar: *mut lua_Debug) -> c_int;
453453
pub fn lua_getinfo(L: *mut lua_State, what: *const c_char, ar: *mut lua_Debug) -> c_int;
454454
pub fn lua_getlocal(L: *mut lua_State, ar: *const lua_Debug, n: c_int) -> *const c_char;

mlua-sys/src/lua52/lualib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub const LUA_DBLIBNAME: *const c_char = cstr!("debug");
1515
pub const LUA_LOADLIBNAME: *const c_char = cstr!("package");
1616

1717
#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))]
18-
extern "C-unwind" {
18+
unsafe extern "C-unwind" {
1919
pub fn luaopen_base(L: *mut lua_State) -> c_int;
2020
pub fn luaopen_coroutine(L: *mut lua_State) -> c_int;
2121
pub fn luaopen_table(L: *mut lua_State) -> c_int;

mlua-sys/src/lua53/lauxlib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct luaL_Reg {
2121
}
2222

2323
#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))]
24-
extern "C-unwind" {
24+
unsafe extern "C-unwind" {
2525
pub fn luaL_checkversion_(L: *mut lua_State, ver: lua_Number, sz: usize);
2626

2727
pub fn luaL_getmetafield(L: *mut lua_State, obj: c_int, e: *const c_char) -> c_int;
@@ -65,7 +65,7 @@ pub const LUA_NOREF: c_int = -2;
6565
pub const LUA_REFNIL: c_int = -1;
6666

6767
#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))]
68-
extern "C-unwind" {
68+
unsafe extern "C-unwind" {
6969
pub fn luaL_ref(L: *mut lua_State, t: c_int) -> c_int;
7070
pub fn luaL_unref(L: *mut lua_State, t: c_int, r#ref: c_int);
7171

@@ -78,7 +78,7 @@ pub unsafe fn luaL_loadfile(L: *mut lua_State, f: *const c_char) -> c_int {
7878
}
7979

8080
#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))]
81-
extern "C-unwind" {
81+
unsafe extern "C-unwind" {
8282
pub fn luaL_loadbufferx(
8383
L: *mut lua_State,
8484
buff: *const c_char,

mlua-sys/src/lua53/lua.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub type lua_Alloc =
102102
unsafe extern "C" fn(ud: *mut c_void, ptr: *mut c_void, osize: usize, nsize: usize) -> *mut c_void;
103103

104104
#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))]
105-
extern "C-unwind" {
105+
unsafe extern "C-unwind" {
106106
//
107107
// State manipulation
108108
//
@@ -172,14 +172,14 @@ pub const LUA_OPLT: c_int = 1;
172172
pub const LUA_OPLE: c_int = 2;
173173

174174
#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))]
175-
extern "C-unwind" {
175+
unsafe extern "C-unwind" {
176176
pub fn lua_arith(L: *mut lua_State, op: c_int);
177177
pub fn lua_rawequal(L: *mut lua_State, idx1: c_int, idx2: c_int) -> c_int;
178178
pub fn lua_compare(L: *mut lua_State, idx1: c_int, idx2: c_int, op: c_int) -> c_int;
179179
}
180180

181181
#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))]
182-
extern "C-unwind" {
182+
unsafe extern "C-unwind" {
183183
//
184184
// Push functions (C -> stack)
185185
//
@@ -265,7 +265,7 @@ pub unsafe fn lua_pcall(L: *mut lua_State, n: c_int, r: c_int, f: c_int) -> c_in
265265
}
266266

267267
#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))]
268-
extern "C-unwind" {
268+
unsafe extern "C-unwind" {
269269
//
270270
// Coroutine functions
271271
//
@@ -300,12 +300,12 @@ pub const LUA_GCSETSTEPMUL: c_int = 7;
300300
pub const LUA_GCISRUNNING: c_int = 9;
301301

302302
#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))]
303-
extern "C-unwind" {
303+
unsafe extern "C-unwind" {
304304
pub fn lua_gc(L: *mut lua_State, what: c_int, data: c_int) -> c_int;
305305
}
306306

307307
#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))]
308-
extern "C-unwind" {
308+
unsafe extern "C-unwind" {
309309
//
310310
// Miscellaneous functions
311311
//
@@ -477,7 +477,7 @@ pub const LUA_MASKCOUNT: c_int = 1 << (LUA_HOOKCOUNT as usize);
477477
pub type lua_Hook = unsafe extern "C-unwind" fn(L: *mut lua_State, ar: *mut lua_Debug);
478478

479479
#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))]
480-
extern "C-unwind" {
480+
unsafe extern "C-unwind" {
481481
pub fn lua_getstack(L: *mut lua_State, level: c_int, ar: *mut lua_Debug) -> c_int;
482482
pub fn lua_getinfo(L: *mut lua_State, what: *const c_char, ar: *mut lua_Debug) -> c_int;
483483
pub fn lua_getlocal(L: *mut lua_State, ar: *const lua_Debug, n: c_int) -> *const c_char;

mlua-sys/src/lua53/lualib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub const LUA_DBLIBNAME: *const c_char = cstr!("debug");
1616
pub const LUA_LOADLIBNAME: *const c_char = cstr!("package");
1717

1818
#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))]
19-
extern "C-unwind" {
19+
unsafe extern "C-unwind" {
2020
pub fn luaopen_base(L: *mut lua_State) -> c_int;
2121
pub fn luaopen_coroutine(L: *mut lua_State) -> c_int;
2222
pub fn luaopen_table(L: *mut lua_State) -> c_int;

0 commit comments

Comments
 (0)