Skip to content

Commit 8fcbc45

Browse files
committed
Make crsqlite working on stable rust
1 parent 58bb015 commit 8fcbc45

File tree

13 files changed

+53
-77
lines changed

13 files changed

+53
-77
lines changed

.github/workflows/c-tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ jobs:
2525
if: runner.os == 'Windows'
2626
run: |
2727
rm core/rs/integration_check/rust-toolchain.toml
28-
rustup component add rust-src --toolchain nightly-2023-10-05-x86_64-pc-windows-gnu
29-
rustup default nightly-2023-10-05-x86_64-pc-windows-gnu
28+
rustup component add rust-src --toolchain 1.93.0
29+
rustup default 1.93.0
3030
3131
- name: Test
3232
run: |

.github/workflows/rs-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ jobs:
2525
if: runner.os == 'Windows'
2626
run: |
2727
find . -name rust-toolchain.toml -exec echo rm {} \;
28-
rustup component add rust-src --toolchain nightly-2023-10-05-x86_64-pc-windows-gnu
29-
rustup default nightly-2023-10-05-x86_64-pc-windows-gnu
28+
rustup component add rust-src --toolchain 1.93.0
29+
rustup default 1.93.0
3030
3131
- name: Test Fractindex
3232
run: |

core/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ $(TARGET_DBG_LOADABLE): $(dbg_prefix) $(ext_files) $(sqlite3.c) $(rs_lib_dbg_loa
213213
# Useful for debugging.
214214
$(TARGET_SQLITE3): $(prefix) $(TARGET_SQLITE3_EXTRA_C) $(rs_lib_dbg_static_cpy) $(shell.c) $(ext_files)
215215
$(CC) -g \
216-
-DSQLITE_THREADSAFE=0 \
216+
-DSQLITE_THREADSAFE=1 \
217217
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
218218
-DSQLITE_EXTRA_INIT=core_init \
219219
-DSQLITE_ENABLE_BYTECODE_VTAB \
@@ -241,7 +241,7 @@ $(TARGET_STATIC): $(prefix) $(ext_files) $(sqlite3.c) $(rs_lib_static_cpy)
241241
$(TARGET_SQLITE3_VANILLA): $(prefix) $(shell.c) $(sqlite3.c)
242242
$(CC) -g \
243243
$(DEFINE_SQLITE_PATH) \
244-
-DSQLITE_THREADSAFE=0 \
244+
-DSQLITE_THREADSAFE=1 \
245245
-I./src/ -I$(sqlite_src) \
246246
$(sqlite3.c) $(shell.c) \
247247
-o $@
@@ -252,7 +252,7 @@ $(TARGET_SQLITE3_EXTRA_C): $(prefix) $(sqlite3.c) src/core_init.c
252252
# run tests
253253
$(TARGET_TEST): $(prefix) $(TARGET_SQLITE3_EXTRA_C) src/tests.c src/*.test.c $(ext_files) $(rs_lib_dbg_static_cpy)
254254
$(CC) -g -Wall \
255-
-DSQLITE_THREADSAFE=0 \
255+
-DSQLITE_THREADSAFE=1 \
256256
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
257257
-DSQLITE_EXTRA_INIT=core_init \
258258
-DUNIT_TEST=1 \
@@ -262,7 +262,7 @@ $(TARGET_TEST): $(prefix) $(TARGET_SQLITE3_EXTRA_C) src/tests.c src/*.test.c $(e
262262

263263
$(TARGET_TEST_ASAN): $(prefix) $(TARGET_SQLITE3_EXTRA_C) src/tests.c src/*.test.c $(ext_files) $(rs_lib_dbg_static_cpy)
264264
$(CC) -fsanitize=address -g -fno-omit-frame-pointer -Wall \
265-
-DSQLITE_THREADSAFE=0 \
265+
-DSQLITE_THREADSAFE=1 \
266266
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
267267
-DSQLITE_EXTRA_INIT=core_init \
268268
-DUNIT_TEST=1 \
@@ -272,7 +272,7 @@ $(TARGET_TEST_ASAN): $(prefix) $(TARGET_SQLITE3_EXTRA_C) src/tests.c src/*.test.
272272

273273
$(TARGET_FUZZ): $(prefix) $(TARGET_SQLITE3_EXTRA_C) src/fuzzer.cc $(ext_files)
274274
clang -fsanitize=fuzzer \
275-
-DSQLITE_THREADSAFE=0 \
275+
-DSQLITE_THREADSAFE=1 \
276276
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
277277
-DSQLITE_EXTRA_INIT=core_init \
278278
-I./src/ -I$(sqlite_src) \

core/rs/bundle/rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2023-10-05"
2+
channel = "1.93.0"
33
components = [ "rust-src", "rustfmt", "clippy" ]

core/rs/bundle/src/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#![no_std]
2-
#![feature(core_intrinsics)]
3-
#![feature(lang_items)]
42

53
extern crate alloc;
64

@@ -26,25 +24,29 @@ static ALLOCATOR: SQLite3Allocator = SQLite3Allocator {};
2624
#[cfg(not(feature = "test"))]
2725
#[panic_handler]
2826
fn panic(_info: &PanicInfo) -> ! {
29-
core::intrinsics::abort()
27+
panic!("panic_handler")
3028
}
3129

3230
// Print panic info for tests
3331
#[cfg(feature = "test")]
3432
#[panic_handler]
3533
fn panic(info: &PanicInfo) -> ! {
3634
println!("PANIC!: {}", info);
37-
core::intrinsics::abort();
35+
panic!("panic_handler")
3836
}
3937

38+
// Otherwise we would need to use nightly features
4039
#[cfg(not(target_family = "wasm"))]
41-
#[lang = "eh_personality"]
42-
extern "C" fn eh_personality() {}
40+
#[no_mangle]
41+
extern "C" fn rust_eh_personality() {}
42+
#[cfg(target_arch = "arm")]
43+
#[no_mangle]
44+
extern "C" fn _rust_eh_personality() {}
4345

4446
#[cfg(target_family = "wasm")]
4547
#[no_mangle]
4648
pub fn __rust_alloc_error_handler(_: Layout) -> ! {
47-
core::intrinsics::abort()
49+
panic!("__rust_alloc_error_handler")
4850
}
4951

5052
#[no_mangle]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2023-10-05"
2+
channel = "1.93.0"
33

core/rs/core/rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[toolchain]
2-
channel = "nightly-2023-10-05"
2+
channel = "1.93.0"

core/rs/core/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![cfg_attr(not(test), no_std)]
2-
#![feature(vec_into_raw_parts)]
32

43
// TODO: these pub mods are exposed for the integration testing
54
// we should re-export in a `test` mod such that they do not become public apis
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[toolchain]
2-
channel = "nightly-2023-10-05"
2+
channel = "1.93.0"

core/rs/fractindex-core/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![cfg_attr(not(test), no_std)]
22
#![allow(non_upper_case_globals)]
3-
#![feature(core_intrinsics)]
43

54
mod as_ordered;
65
mod fractindex;

0 commit comments

Comments
 (0)